1

I have the following table:

create table my table (id SERIAL PRIMARY KEY,value TEXT);

And I try to find the sequence that serial creates:

SELECT sequence_schema, sequence_name 
FROM information_schema.sequences 
ORDER BY sequence_name ;

How I can associate a listed serial with table.id Primary Key?

0

1 Answer 1

2

You can try "information_schema.columns" table

SELECT column_name, column_default
FROM information_schema.columns
WHERE column_default ilike '%nextval%';

Not the answer you're looking for? Browse other questions tagged or ask your own question.