Answers for "postgresql indexof"

SQL
0

postgresql index id

postgres@db # SELECT a.attname
FROM pg_class t
     JOIN pg_index ix ON t.oid = ix.indrelid
     JOIN pg_class i ON i.oid = ix.indexrelid
     JOIN pg_attribute a ON a.attrelid = t.oid
WHERE 
     a.attnum = ANY(ix.indkey) AND 
     t.relkind = 'r' AND 
     t.relname ='test' -- table name
ORDER BY
     t.relname,
     i.relname;
 attname 
---------
 column1
 column2
 id
(3 rows)
Posted by: Guest on March-16-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language