Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
Date: 2023-03-19 22:26:41
Message-ID: 803987.1679264801@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com> writes:
> I am trying to find a simple way to get access the DDL information for
> PostgreSQL tables, constraints, and indices via SQL.

There are bits of that, but it's not terribly complete or consistent
because nobody's made a concerted effort to build stuff that wasn't
driven by "what does pg_dump need". (And what pg_dump needs, for
the most part, is not simply "give me all the DDL for this object
in a black box".)

I'd suggest taking a look at the pg_get_* functions, which are
mostly documented at

https://www.postgresql.org/docs/current/functions-info.html

There are some other things on that page that might help, too.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message MichaelDBA 2023-03-20 00:27:48 Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
Previous Message richard coleman 2023-03-19 21:36:17 PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl