Re: Retail DDL
Thom Brown <thom@linux.com>
From: Thom Brown <thom@linux.com>
To: Matheus Alcantara <matheusssilv97@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-24T20:58:00Z
Lists: pgsql-hackers
On Thu, 24 Jul 2025 at 21:46, Matheus Alcantara
<matheusssilv97@gmail.com> wrote:
>
> On Thu Jul 24, 2025 at 5:26 PM -03, Andrew Dunstan wrote:
> > Some years ago I gave a talk about $subject, but somehow it dropped off
> > my radar. Now I'm looking at it again. The idea is to have a function
> > (or set of functions) that would allow the user to get the DDL for any
> > database object. Obviously we already have some functions for things
> > like views and triggers, but most notably we don't have one for tables,
> > something users have long complained about. I have been trying to think
> > of a reasonable interface for a single function, where we would pass in,
> > say, a catalog oid plus an object oid, and maybe some optional extra
> > arguments. That seems a bit fragile, though. The alternative is that we
> > have a separate function for each object type, e.g.
> > pg_get_{objecttype}_ddl. I'm kinda leaning that way, but I'd like some
> > sort of consensus before any work gets done.
> >
> What about SHOW CREATE TABLE? Some other databases support this syntax.
SHOW is reserved for returning parameters. I don't think we want to
muddy the purpose of that command.
--
Thom Brown
Data Egret (https://dataegret.com)