From: TJ O'Donnell <tjo@acm.org>
To: cbbrowne@acm.org
To: pgsql-sql@postgresql.org
Subject: Re: Desc Commnad in pgsql?
Date: Sun, 20 Apr 2008 17:14:03 -0700
Message-ID: <480BDC4B.9010104@acm.org> (raw)
In-Reply-To: <20080420182009.56E5F8F0AE0@maia-1.hub.org>
References: <20080420182009.56E5F8F0AE0@maia-1.hub.org>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tjo@acm.org, cbbrowne@acm.org
Subject: Re: Desc Commnad in pgsql?
In-Reply-To: <480BDC4B.9010104@acm.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox