How to force Supabase identity column to auto increment on Upsert

31 Views Asked by At

Am connecting to my Supabase project from C#, I have a table that the primary key is not the 'id' but another column that am getting from multiple systems.

On insert everything works just fine, but on upsert, I send a request to upsert(I don't know if the record is there or not) and without the 'id' field. I was surprised that the record was added but with id of 0 and if I continue to add more records using the upsert I will always get the id as 0.

The 'id' column is set as identity field and I tried to add the is unique constraint also, but that didn't work also. I want the id to be autoincremented if the record is a new record.

0

There are 0 best solutions below