-
Notifications
You must be signed in to change notification settings - Fork 538
Closed
Labels
bugSomething isn't workingSomething isn't workingpostgrest-jsRelated to the postgrest-js library.Related to the postgrest-js library.wontfixThis will not be worked onThis will not be worked on
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
I want to bulk update, but must use upsert. I use upsert but receive issues on non-null columns when they are not provided, despite the value existing on the record in the db.
To Reproduce
Example table:
CREATE TABLE test_table (
id text primary key,
other_column text null,
name text not null --<--- The problem
);
INSERT INTO test_table (id, other_column, name)
VALUES ('id1',null,'some_name');
Updating a single row (via upsert): I know the record exists and the name column is populated. However if I try to upsert:
await supabase
.from('test_table')
.upsert([
{ id: 'id1', other_column: 'other_column_text' }
])
I receive
{
code: '23502',
details: 'Failing row contains (id1, other_column_text, null).',
hint: null,
message: 'null value in column "name" of relation "test_table" violates not-null constraint'
}
Expected behavior
The row show be "merged", thus it should just update the two columns I provided, and not default the name column to null, which in this case is not allowed.
- OS: macOS
- "@supabase/ssr": "^0.0.10",
"@supabase/supabase-js": "^2.39.2", - Version of Node.js: v20.10.0
MaximusMcCann, brunobely, lexum0, magdalipka, caelinsutch and 4 morecarlosseru, bobbybol and Jackmekiss
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpostgrest-jsRelated to the postgrest-js library.Related to the postgrest-js library.wontfixThis will not be worked onThis will not be worked on