You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Been fighting an issue today where I couldn't do a simple upsert of an object looked like {id: 123, value: "myvalue"}
The primary key of the table is id but the import would fail with a "null value in column "required_value" violates not-null constraint" error.
As soon as I include the two required values, everything runs smoothly.
Digging into the script.js for postgres, I believe it is because of how the upsert logic works.
INSERT INTO public.mytable (
"id",
"required_value",
"myvalue",
... long list of columns
)
VALUES
(
123,
DEFAULT
"insertedvalue",
... long list of DEFAULT
) ON CONFLICT ("id") DO
UPDATE
SET
"id" = 6,
Because "required_value" is NOT NULL and there is no default, the query fails. No idea how to fix it as SQL isn't my strength, but this appears to be a bug.
The text was updated successfully, but these errors were encountered:
Been fighting an issue today where I couldn't do a simple upsert of an object looked like
{id: 123, value: "myvalue"}
The primary key of the table is
id
but the import would fail with a"null value in column "required_value" violates not-null constraint"
error.As soon as I include the two required values, everything runs smoothly.
Digging into the script.js for postgres, I believe it is because of how the upsert logic works.
Because "required_value" is NOT NULL and there is no default, the query fails. No idea how to fix it as SQL isn't my strength, but this appears to be a bug.
The text was updated successfully, but these errors were encountered: