Skip to content

Expression<Int64> is broken #1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hansengj opened this issue Mar 24, 2025 · 2 comments
Open

Expression<Int64> is broken #1311

hansengj opened this issue Mar 24, 2025 · 2 comments

Comments

@hansengj
Copy link

Running v0.15.3 under Xcode 16.2

Under Usage:
let id = Expression("id")

t.column(id, primaryKey: true)

is suppose to translate to the query clause
"id" INTEGER PRIMARY KEY NOT NULL
Instead it is translated to
"id" TEXT PRIMARY KEY NOT NULL

Note: Under Xcode 16, it now necessary to include the argument label 'value.
let id = Expression(value: "id")

After executions id is
id SQLite.Expression
when it should be
id SQLite.Expression

The problem is the code base takes its UnderlyingType from "id", which is a String,
not from . See Expression.swift, line 110.

The fact Expression is translated to TEXT is further exemplified by
the following code which will no longer compile:

enum booleans: Int64 {
case TRUE = 1, FALSE = 0
}
let isActive = Expression(value: "isActive")

t.column(isActive, defaultValue: booleans.TRUE.rawValue)

results in the compiler error:

Cannot convert value of type 'Expression' to expected argument type 'Expression<Int64?>'

@Nixiaxia
Copy link

Nixiaxia commented Apr 1, 2025

Solution:
#1277

@hansengj
Copy link
Author

hansengj commented Apr 1, 2025

let id = SQLite.Expression("id") works. Note: Do not add "value:" before parameter

Suggest documentation and example code add "SQLite." before Expression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants