How can I get a list of identity columns for a table in Amazon Redshift? (using system's tables)
Thank you.
For those who might be interested to know about how to get all identity columns in a Redshift DB. The following query was posted by Neil@AWS to AWS Redshift Forum:
select
c.relname,
a.attname
from pg_class c, pg_attribute a, pg_attrdef d
where c.oid = a.attrelid
and c.relkind = 'r'
and a.attrelid = d.adrelid
and a.attnum = d.adnum
and d.adsrc like '%identity%'
order by 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With