Re: Desc Commnad in pgsql? - Mailing list pgsql-sql

From TJ O'Donnell
Subject Re: Desc Commnad in pgsql?
Date
Msg-id 480BDC4B.9010104@acm.org
Whole thread Raw
In response to Desc Commnad in pgsql?  (VG <vikasraigupta@gmail.com>)
Responses Re: Desc Commnad in pgsql?  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-sql
I like the table and other info from psql
and find I sometimes need that info in my client programs.
Are there any SQL/plpgsql functions that are analogous
to the psql \dt, \ds, etc. commands?
For example
create function d_table(table_name text) returns setof record
that could be used in SQL commands in client programs?
I am not concerned whether these are compatible with other
RDBMS.

TJ O'Donnell
http://www.gnova.com

> 
> If you're looking for ways to "describe" a table, there are two
> mechanisms:
> 
>   1.  SQL standard (probably SQL:1993) describes an
>   "information_schema" which contains tables or views that allow
>   querying database metadata in a fairly standard fashion.
> 
>   PostgreSQL supports that.
> 
>   2.  Probably easier and friendlier, albeit nonportable, is to use
>   the psql "\d" command.
> > >>
>> For instance:
>> \dt will list all tables
>> \ds will list all sequences
>> \dv will list all views
>> and there's a further cast of ~20 variants for various different sorts
>> of objects.



pgsql-sql by date:

Previous
From: Jean-David Beyer
Date:
Subject: Re: How to find double entries
Next
From: Theerasak Maneeneim
Date:
Subject: Error: could not find pathkey item to sort