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?

Dimitrios Desyllas
  • 873
  • 2
  • 14
  • 30

1 Answers1

2

You can try "information_schema.columns" table

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