Feature Request - Table Definition query

Lists: pgsql-hackers
From: Wilfried Schobeiri <schobeiriw(at)videofurnace(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Feature Request - Table Definition query
Date: 2008-10-28 19:04:59
Message-ID: 8F38740B-B490-4D19-AD04-8DD52482578E@videofurnace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Howdy!

It was suggested to me that this proposed feature is interesting
enough to be floated around for discussion.
Don't get your hopes up, because the request is extremely simple:

It could be useful to have a command that returns the table definition
(like pg_dump -st) from within the query interface. This could be
particularly useful if one doesn't have access to or prefers not to
manipulate results coming from a shell. If I have an API from which to
query the database, it seems silly to have to spawn a shell and run a
command to query the very same database.

(I'm not exactly familiar with how pg_dump manipulates or extracts
that data, so this could be a very, very stupid question. If so,
please forgive me.)

Regards,
Wilfried Schobeiri


From: Svenne Krap <svenne(at)krap(dot)dk>
To: Wilfried Schobeiri <schobeiriw(at)videofurnace(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feature Request - Table Definition query
Date: 2008-10-29 08:20:24
Message-ID: 49081CC8.4010008@krap.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> It could be useful to have a command that returns the table definition
> (like pg_dump -st) from within the query interface. This could be
> particularly useful if one doesn't have access to or prefers not to
> manipulate results coming from a shell. If I have an API from which to
> query the database, it seems silly to have to spawn a shell and run a
> command to query the very same database.
Yes. That functionality would be really appreciated by myself and a few
pgsql-users I know.
> (I'm not exactly familiar with how pg_dump manipulates or extracts
> that data, so this could be a very, very stupid question. If so,
> please forgive me.)
Me neither, but I think one of the problems is, that during upgrade you
are supposed to use pg_dump from the new version on the existing
database instance.
The server could most probably only generate its own format (not the
new) which might be a problem.

Perhaps it could be implemented by stored function (autoinstalled and
available in contrib or perhaps installed by a psql on first run) in a
namespace like pg_dump_84 (i.e. tagged with server version). If you want
to upgrade you could then install the new set of functions..
Psql could then be a thin wrapper (which calls the needed functions).

/Svenne