Skip to content

Crash when unique constraint fails using C-API wrapper #491

Closed
@ghost

Description

I get a crash when doing the following:

try Array(databaseConnection.prepare("CREATE TABLE \"users\" (\"id\" INTEGER PRIMARY KEY NOT NULL, \"name\" TEXT, \"email\" TEXT NOT NULL UNIQUE)"))

try Array(databaseConnection.prepare("INSERT INTO users (email) VALUES (\"betty@icloud.com\"), (\"cathy@icloud.com\")"))

try Array(databaseConnection.prepare("INSERT INTO users (email) VALUES (\"betty@icloud.com\"), (\"cathy@icloud.com\")"))

crashes with

fatal error: 'try!' expression unexpectedly raised an error: UNIQUE constraint failed: users.email: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-703.0.18.8/src/swift/stdlib/public/core/ErrorType.swift, line 54

Related to #430, but I made a new issue because it might be specific to the C API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions