I created an identity column through the supabase ...
# help
m
I created an identity column through the supabase dashboard, but now I'm having trouble inserting rows through the sql editor. When opening the column details I can see 'is identity' is checked, and when inserting a row through postgrest (via supabase-js) the identity column works. But that same insert statement directly through the sql editor fails (there's an insert trigger on this table insert which depends on the generated sequential id), and what's strange to me is that the sequence is not shown in the
information_schema.sequences
schema. Anybody got any ideas? Column definition:
Copy code
SELECT 
   table_name, 
   column_name, 
   data_type 
FROM 
   information_schema.columns
WHERE 
   table_name = 'booking' AND column_name = 'sequential_id';

>
| table_catalog | table_schema | table_name | column_name   | column_default | is_nullable | data_type | is_identity | identity_generation | identity_cycle | is_generated | generation_expression |
| ------------- | ------------ | ---------- | ------------- | -------------- | ----------- | --------- | ----------- | ------------------- | -------------- | ------------ | --------------------- |
| postgres      | public       | booking    | sequential_id |                | NO          | integer   | YES         | ALWAYS              | NO             | NEVER        |                       |
`information_schema.sequences`:
Copy code
SELECT * FROM information_schema.sequences WHERE sequence_schema = 'public';
> Success. No rows returned
Copy code
SELECT currval(pg_get_serial_sequence('booking','sequential_id'));
> currval of sequence "Booking_sequential_id_seq" is not yet defined in this session
s
Please provide the table structure and so on as code blocks inline here.
m
Of course, sorry updated the original question. I'm triggered by the
currval of sequence "Booking_sequential_id_seq" is not yet defined in this session
message in the last query. So it seems there is indeed a sequence postgres knows of, but i'm still trying to figure out what the
is not yet defined in this session
part comes from.
Ah solved. I was completely on the wrong track here. Turned out the trigger was invoking a function, without explicitly defining the extensions schema. Appearently this failed when called as an authenticated user, but not as the admin. Fixed it now 🙂