pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: richard coleman <rcoleman.ascentgl@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
Date: Sun, 19 Mar 2023 18:26:41 -0400
Message-ID: <803987.1679264801@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGA3vBt=an4RqygEvUeeLPB_s0W92hC2DtjFmxV2eKu93NWOKA@mail.gmail.com>
References: <CAGA3vBt=an4RqygEvUeeLPB_s0W92hC2DtjFmxV2eKu93NWOKA@mail.gmail.com>

richard coleman <rcoleman.ascentgl@gmail.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





view thread (20+ messages)  latest in thread

Message-ID: <803987.1679264801@sss.pgh.pa.us>
Permalink:  ../803987.1679264801@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/803987.1679264801@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rcoleman.ascentgl@gmail.com
  Subject: Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
  In-Reply-To: <803987.1679264801@sss.pgh.pa.us>

* 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