Supabase | cannot insert a non-DEFAULT value into column

01kg

01kg

Posted on September 30, 2024

Supabase | cannot insert a non-DEFAULT value into column

Full Error:

PostgrestException(message: cannot
 insert a non-DEFAULT value into 
column "id", code: 428C9, details: 
Column "id" is an identity column 
defined as GENERATED ALWAYS., hint: 
Use OVERRIDING SYSTEM VALUE to override.)
Enter fullscreen mode Exit fullscreen mode

Table:

create table dog (
  id bigint generated always as identity primary key,
  name text,
  description text,
  user_id uuid references auth.users on delete cascade on update cascade
);
Enter fullscreen mode Exit fullscreen mode

Solution

According to this answer, no way to use OVERRIDING SYSTEM VALUE in Supabase.

Should use generated by default while creating "id" field.

💖 💪 🙅 🚩
01kg
01kg

Posted on September 30, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related