Re: newbie question... how do I get table structure?

From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aaron Bratcher <aaronbratcher(at)abdatatools(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: newbie question... how do I get table structure?
Date: 2004-02-06 17:33:37
Message-ID: 1076088817.12238.13.camel@taz.oficina.oficina
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

that's great, I didn't know about the information schema... guess I
never read the 'what's new' document :)

On Fri, 2004-02-06 at 13:15, Tom Lane wrote:

> Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar> writes:
> > Does anyone know if the ansi sql standard defines any way to do this?
> > I've seen the DESCRIBE TABLE/INDEX/... or SHOW TABLE/INDEX/... commands
> > in other databases, but I don't really know if they are extensions or
> > not.
>
> They are extensions (and very nonstandard ones at that). What the SQL
> standard provides are standardized views of the system catalogs located
> in the INFORMATION_SCHEMA schema. The per-spec way to do this would
> be something like
>
> select column_name, data_type
> from information_schema.columns
> where table_name = 'foo'
> order by ordinal_position;
>
> Now Postgres only got around to supporting the INFORMATION_SCHEMA views
> in 7.4 (although in principle you could have defined most of these views
> earlier, certainly in 7.3). I'm not real sure how many other DBs
> support INFORMATION_SCHEMA either ... it may not be all that "standard".
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Siracusa 2004-02-06 18:19:51 Indexes and sorting
Previous Message Joe Conway 2004-02-06 17:33:20 Re: [GENERAL] dblink - custom datatypes don't work