Thread: Table and Field Schemas

Table and Field Schemas

From
Adam Ernst
Date:
How can I get the table schema for a database or the field schema for a
table? I'm connected remotely via a socket, so I can't just dump it an
inspect the result.

Even if I could just verify the existence of a table/field, that would
work.

Adam Ernst


Re: Table and Field Schemas

From
Richard Huxton
Date:
Adam Ernst wrote:
> How can I get the table schema for a database or the field schema for a
> table? I'm connected remotely via a socket, so I can't just dump it an
> inspect the result.
>
> Even if I could just verify the existence of a table/field, that would
> work.

If you start psql with the -E flag then \d etc will show the queries
they send.

You might also want to consider looking at the information_schema schema
which provides a standardised view of database structure.

--
   Richard Huxton
   Archonet Ltd