DEV Community

01kg
01kg

Posted on

1

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.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay