From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Adding SHOW CREATE TABLE |
Date: | 2023-05-19 21:06:00 |
Message-ID: | fbde7a194938f79580ef0cebb34f2b174b26b56a.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
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(at)gmail(dot)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
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.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Ziga | 2023-05-19 21:31:00 | Re: Adding SHOW CREATE TABLE |
Previous Message | Corey Huinker | 2023-05-19 20:57:44 | Re: Adding SHOW CREATE TABLE |
From | Date | Subject | |
---|---|---|---|
Next Message | Ziga | 2023-05-19 21:31:00 | Re: Adding SHOW CREATE TABLE |
Previous Message | Corey Huinker | 2023-05-19 20:57:44 | Re: Adding SHOW CREATE TABLE |