From: Stephen Frost <sfrost@snowman.net>
To: Nathaniel Sabanski <sabanski.n@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Adding SHOW CREATE TABLE
Date: Fri, 12 May 2023 16:14:27 -0400
Message-ID: <ZF6eIysBeQrXpz7r@tamriel.snowman.net> (raw)
In-Reply-To: <CAFEN2wxg0Vtj1gvk6Ms0L2CAutbycyxHZPiZSpW7eLsBc6VGnA@mail.gmail.com>
References: <CAFEN2wxsDSSuOvrU03CE33ZphVLqtyh9viPp6huODCDx2UQkYA@mail.gmail.com>
<ZF5Da5Ge1+RpiviX@tamriel.snowman.net>
<CAFEN2wzmO-VqOjOU3EyWzBCckDY3-_nv5sXQJPunteNHq9r11A@mail.gmail.com>
<7a5d6750-84fa-59b0-33c1-7a5d26b9bc74@evolvis.org>
<CAKFQuwa2cYznMsZRdfDXqDD0T5F+cRruZxfu_W9BtDh+A5RYHg@mail.gmail.com>
<CAFEN2wwzcNot7OuV-4CLo5qf8UNZyc7pkEitJiYrj6VRTL4vmQ@mail.gmail.com>
<CAFEN2wxg0Vtj1gvk6Ms0L2CAutbycyxHZPiZSpW7eLsBc6VGnA@mail.gmail.com>
Greetings,
* Nathaniel Sabanski (sabanski.n@gmail.com) wrote:
> > Perhaps a bit more discussion about what exactly the use-case is would
> > be helpful- what would you use this feature for?
>
> App writers: To facilitate table creation and simplify schema verification,
> without relying on a GUI tool or ORM (or system calls out to pg_dump).
Not sure how it would simplify schema verification?
> Tool writers: Would drastically cut down the implementation time and
> complexity to support Postgres. I am one of the devs of Piccolo ORM (Python
> lib supporting Postgres) and we have a lot of code dedicated to
> re-generating the CREATE TABLE statements (creation, during migrations,
> etc) that could be done better by Postgres itself.
I'm curious- have you compared what you're doing to pg_dump's output?
Are you confident that there aren't any distinctions between those that,
for whatever reason, need to exist?
> Moving to Postgres: It would help ease migrations for developers wanting to
> move from MySQL / Percona / MariaDB to Postgres. Also it's a nice developer
> experience to see how Postgres generates X table without extra tooling.
Seems unlikely that this would actually be all that helpful there- tools
like ora2pg and similar know how to query other database systems and
write appropriate CREATE TABLE statements for PostgreSQL.
> The intention of SHOW CREATE TABLE is not to replace the existing suite of
> \d in psql but rather to be a developer friendly complement within SQL
> itself.
Sure, I get that.
Again, would be great to see someone actually work on this. There's
already a good chunk of code in core in pg_dump and in the postgres_fdw
for doing exactly this and it'd be great to consolidate that and at the
same time expose it via SQL.
Another possible option would be to add this to libpq, which is used by
postgres_fdw, psql, pg_dump, and lots of other drivers and client
utilities. If it's all broadly the same, personally I'd prefer it to be
in the common library and available as a backend SQL command too, but
perhaps there's reasons that it would be easier to implement in libpq
instead.
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, sabanski.n@gmail.com
Subject: Re: Adding SHOW CREATE TABLE
In-Reply-To: <ZF6eIysBeQrXpz7r@tamriel.snowman.net>
References: <CAFEN2wxsDSSuOvrU03CE33ZphVLqtyh9viPp6huODCDx2UQkYA@mail.gmail.com> <ZF5Da5Ge1+RpiviX@tamriel.snowman.net> <CAFEN2wzmO-VqOjOU3EyWzBCckDY3-_nv5sXQJPunteNHq9r11A@mail.gmail.com> <7a5d6750-84fa-59b0-33c1-7a5d26b9bc74@evolvis.org> <CAKFQuwa2cYznMsZRdfDXqDD0T5F+cRruZxfu_W9BtDh+A5RYHg@mail.gmail.com> <CAFEN2wwzcNot7OuV-4CLo5qf8UNZyc7pkEitJiYrj6VRTL4vmQ@mail.gmail.com> <CAFEN2wxg0Vtj1gvk6Ms0L2CAutbycyxHZPiZSpW7eLsBc6VGnA@mail.gmail.com> <ZF6eIysBeQrXpz7r@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