Define a SERIAL (AUTO INCREMENT) column in postgresql

How to use a query in the information schema to determine the serial column by specifying the required table.

Upd.Solution:

SELECT * FROM information_schema.columns WHERE table_name='test' and column_default like 'nextval%'
Author: Novitskiy Denis, 2020-06-04

1 answers

The data can be found in the information_schema.columns table. The request looks like this:

SELECT * FROM information_schema.columns 
WHERE table_name='test' and column_default like 'nextval%'

Fiddle

 0
Author: Novitskiy Denis, 2020-06-05 05:47:18