Re: Adding SHOW CREATE TABLE - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Adding SHOW CREATE TABLE
Date
Msg-id 6afd776b-45cf-2675-0cfe-981f1c6ade1d@dunslane.net
Whole thread Raw
In response to Re: Adding SHOW CREATE TABLE  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Adding SHOW CREATE TABLE
Re: Adding SHOW CREATE TABLE
Re: Adding SHOW CREATE TABLE
Re: Adding SHOW CREATE TABLE
List pgsql-hackers


On 2023-05-18 Th 19:53, Stephen Frost wrote:
Greetings,

* 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).  This trivializes the approach,
and requires the smallest set of changes (psql is already close with
existing queries, etc).

And frankly, I would rather have an \st feature that handles 99% of the use
cases then go 15yrs waiting for a perfect solution.
Once this works well for the group.  Then, IMO, that would be the time to
discuss moving it.
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..

Using libpq would also make sense from the perspective that libpq can be
used to connect to a number of different major versions of PG and this
could work work for them all in much the way that pg_dump does.

The downside with this apporach is that drivers which don't use libpq
(eg: JDBC) would have to re-implement this if they wanted to keep
feature parity with libpq..


I think the ONLY place we should have this is in server side functions. More than ten years ago I did some work in this area (see below), but it's one of those things that have been on my ever growing personal TODO list

See <https://bitbucket.org/adunstan/retailddl/src/master/> and <https://www.youtube.com/watch?v=fBarFKOL3SI>


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: New COPY options: DELIMITER NONE and QUOTE NONE
Next
From: Alvaro Herrera
Date:
Subject: Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)