extracting meta info from a table psql using information_schema

89 Views Asked by At

How do I extract following meta information from a psql table. column_name, data_type, char_max_length,numeric_precision,constraint_type, constraint_reference, check_clause .In short the information that we have got by this query "\d table_name".

1

There are 1 best solutions below

0
On

Start psql with the -E flag, and take note of the queries it generates when you issue \d table_name -- you'll need to reproduce many or most of those queries in order to get all the metadata you're asking for.