From: Stephen Frost <sfrost@snowman.net>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Adding SHOW CREATE TABLE
Date: Sat, 20 May 2023 13:26:29 -0400
Message-ID: <ZGkCxT614Kg4emrs@tamriel.snowman.net> (raw)
In-Reply-To: <fbde7a194938f79580ef0cebb34f2b174b26b56a.camel@cybertec.at>
References: <ZF6jY1vqhxfGME+b@tamriel.snowman.net>
<CACLU5mROQewFBFXG=C6DMvEtDgGZoF9k=m_bkTJYFgSNZptUkg@mail.gmail.com>
<1aac01a1-d9db-8048-9bfa-1e4f9bb69a03@gmail.com>
<CACLU5mQDDhdwu4Z8aRqNrc+UDLTE+GmfZPbxn39dha5m_EUEfQ@mail.gmail.com>
<CAM8SmLV3RcGHsnhwk9=vAdhUGnYfCQ9xUsrBdXwyKn=_9wCDLw@mail.gmail.com>
<CACLU5mSmZ0hoCbbkGBS7X2jczC8bmP5PE+w=BC=UvAp+36AoBw@mail.gmail.com>
<CACLU5mQmq2r6FicCXm7Rj2JbyTyDdAdTEcSFAfO6bnK7x+S6aA@mail.gmail.com>
<ZGa6lrLlZVIarDK4@tamriel.snowman.net>
<6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net>
<fbde7a194938f79580ef0cebb34f2b174b26b56a.camel@cybertec.at>
Greetings,
* Laurenz Albe (laurenz.albe@cybertec.at) wrote:
> On Fri, 2023-05-19 at 13:08 -0400, Andrew Dunstan wrote:
> > On 2023-05-18 Th 19:53, Stephen Frost wrote:
> > > * Kirk Wolak (wolakk@gmail.com) wrote:
> > > > My approach for now is to develop this as the \st command.
> > > > After reviewing the code/output from the 3 sources (psql, fdw, and
> > > > pg_dump).
> > >
> > > Having this only available via psql seems like the least desirable
> > > option as then it wouldn't be available to any other callers..
> > >
> > > Having it in libpq, on the other hand, would make it available to psql
> > > as well as any other utility, library, or language / driver which uses
> > > libpq, including pg_dump..
> >
> > I think the ONLY place we should have this is in server side functions.
>
> +1
... but it already exists in pg_dump, so I'm unclear why folks seem to
be pushing to have a duplicate of it in core? We certainly can't remove
it from pg_dump even if we add it to core because pg_dump has to
understand the changes between major versions.
> A function "pg_get_tabledef" would blend nicely into the following list:
>
> \df pg_get_*def
> List of functions
> Schema │ Name │ Result data type │ Argument data types │ Type
> ════════════╪════════════════════════════════╪══════════════════╪═══════════════════════╪══════
> pg_catalog │ pg_get_constraintdef │ text │ oid │ func
> pg_catalog │ pg_get_constraintdef │ text │ oid, boolean │ func
> pg_catalog │ pg_get_functiondef │ text │ oid │ func
> pg_catalog │ pg_get_indexdef │ text │ oid │ func
> pg_catalog │ pg_get_indexdef │ text │ oid, integer, boolean │ func
> pg_catalog │ pg_get_partition_constraintdef │ text │ oid │ func
> pg_catalog │ pg_get_partkeydef │ text │ oid │ func
> pg_catalog │ pg_get_ruledef │ text │ oid │ func
> pg_catalog │ pg_get_ruledef │ text │ oid, boolean │ func
> pg_catalog │ pg_get_statisticsobjdef │ text │ oid │ func
> pg_catalog │ pg_get_triggerdef │ text │ oid │ func
> pg_catalog │ pg_get_triggerdef │ text │ oid, boolean │ func
> pg_catalog │ pg_get_viewdef │ text │ oid │ func
> pg_catalog │ pg_get_viewdef │ text │ oid, boolean │ func
> pg_catalog │ pg_get_viewdef │ text │ oid, integer │ func
> pg_catalog │ pg_get_viewdef │ text │ text │ func
> pg_catalog │ pg_get_viewdef │ text │ text, boolean │ func
> (17 rows)
>
>
> A server function can be conveniently called from any client code.
Clearly any client using libpq can conveniently call code which is in
libpq.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: sfrost@snowman.net, laurenz.albe@cybertec.at, andrew@dunslane.net, pgsql-hackers@lists.postgresql.org
Subject: Re: Adding SHOW CREATE TABLE
In-Reply-To: <ZGkCxT614Kg4emrs@tamriel.snowman.net>
References: <ZF6jY1vqhxfGME+b@tamriel.snowman.net> <CACLU5mROQewFBFXG=C6DMvEtDgGZoF9k=m_bkTJYFgSNZptUkg@mail.gmail.com> <1aac01a1-d9db-8048-9bfa-1e4f9bb69a03@gmail.com> <CACLU5mQDDhdwu4Z8aRqNrc+UDLTE+GmfZPbxn39dha5m_EUEfQ@mail.gmail.com> <CAM8SmLV3RcGHsnhwk9=vAdhUGnYfCQ9xUsrBdXwyKn=_9wCDLw@mail.gmail.com> <CACLU5mSmZ0hoCbbkGBS7X2jczC8bmP5PE+w=BC=UvAp+36AoBw@mail.gmail.com> <CACLU5mQmq2r6FicCXm7Rj2JbyTyDdAdTEcSFAfO6bnK7x+S6aA@mail.gmail.com> <ZGa6lrLlZVIarDK4@tamriel.snowman.net> <6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net> <fbde7a194938f79580ef0cebb34f2b174b26b56a.camel@cybertec.at> <ZGkCxT614Kg4emrs@tamriel.snowman.net>
* 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