Re: Table description

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Livia Santos" <liviasilvasantos(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Table description
Date: 2007-08-20 15:08:23
Message-ID: dcc563d10708200808v6c8931fctc3a2edb47c2b10b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/20/07, Livia Santos <liviasilvasantos(at)gmail(dot)com> wrote:
> Hi.
>
> Is there any command that describe a table, such as desc table_name as in
> Oracle?

Yes and no. The psql client has a series of \ commands that can
describe pretty much anything in the db in a pretty print nature and a
minimum of typing. The \ commands are NOT implemented in the backend,
but in the psql client so you can't just hit the db with \d from a
libpq connection to get a list of all tables / views / sequences.

However, you can use psql -E to have psql show you al lthe queries
it's throwing at the backend to get that pretty output, and then you
can take what it's doing and either wrap it in a view for future use,
or run it directly.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Gravsjö 2007-08-20 15:09:11 Re: Table description
Previous Message Richard Broersma Jr 2007-08-20 15:07:00 Re: Table description