Hi there,
I've got a table whose primary key is generated via:
mkConstraints (TableSchema (QualifiedName table_name _) table) (AutoInc f) =
sql $ BS8.pack $ unwords
[ "ALTER TABLE"
, table_name
, "ALTER COLUMN"
, nameToString $ f table
, "ADD GENERATED ALWAYS AS IDENTITY"
]
This works fine and dandy whenever i use unsafeDefault to insert the key. But I'm now doing a backfill from an existing datasource, and require non-defaults for these keys. Attempting to run the (Haskell-well-typed) query results in:
ResultError (ServerError "428C9" "cannot insert a non-DEFAULT value into column \"user_id\"" (Just "Column \"user_id\" is an identity column defined as GENERATED ALWAYS.") (Just "Use OVERRIDING SYSTEM VALUE to override.") Nothing)
Explicitly setting OVERRIDING SYSTEM VALUE when generating inserts seems reasonable to me. If you're going to make me fill it in myself, you might as well respect what I stick in if it isn't DEFAULT :)
Hi there,
I've got a table whose primary key is generated via:
This works fine and dandy whenever i use
unsafeDefaultto insert the key. But I'm now doing a backfill from an existing datasource, and require non-defaults for these keys. Attempting to run the (Haskell-well-typed) query results in:Explicitly setting
OVERRIDING SYSTEM VALUEwhen generating inserts seems reasonable to me. If you're going to make me fill it in myself, you might as well respect what I stick in if it isn'tDEFAULT:)