https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
d

dimsuz

10/16/2023, 11:57 AM
I wonder why sqldelight 2.0.0 generate a nullable value here?
Copy code
CREATE TABLE AnalysisHistoryEntry (
  id INTEGER NOT NULL PRIMARY KEY,
  ...
)

insertOrReplace:
INSERT OR REPLACE
INTO AnalysisHistoryEntry
VALUES (?, ?, ?, ?, ?, ?, ?);
generates:
Copy code
public fun insertOrReplace(
    id: Long?,
    ...
  )
Is this a bug? Seeing this in all my tables.
h

hfhbd

10/16/2023, 12:55 PM
Definitely a bug
a

Andrew O'Hara

10/16/2023, 4:38 PM
Maybe try explicitly defining your columns in the insert statement, like:
Copy code
insertOrReplace:
INSERT OR REPLACE
INTO AnalysisHistoryEntry (id, foo, bar, baz)
VALUES (:id, :foo, :bar, :baz);
👍 1
d

dimsuz

10/17/2023, 11:07 AM
I'll try, but still looks like a bug, because generator outputs "id: Long?", so it knows which column is which (by default), so it could derive its nullability
a

Andrew O'Hara

10/17/2023, 4:07 PM
Yes, I agree. Might be worth a shot as a workaround.
👍 1
2 Views