Skip to content

Expression<Int64> is broken #1311

@hansengj

Description

@hansengj

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?>'

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