From: | richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com> |
---|---|
To: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl |
Date: | 2023-03-19 21:36:17 |
Message-ID: | CAGA3vBt=an4RqygEvUeeLPB_s0W92hC2DtjFmxV2eKu93NWOKA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hello all,
I am trying to find a simple way to get access the DDL information for
PostgreSQL tables, constraints, and indices via SQL.
In Oracle there are the dbms_metadata.get_ddl()
and dbms_metadata.get_dependent_ddl() functions that you can call on dual
to get this information.
EX:
-- table DDL:
select dbms_metadata.get_ddl('TABLE', 'MY_TABLE','MY_SCHEMA') as
"table_ddl" from dual;
-- indices DDL
select dbms_metadata.get_dependent_ddl('INDEX','MY_TABLE','MY_SCHEMA') as
"table_indicies" from dual;
-- constraints DDL
select dbms_metadata.get_dependent_ddl('CONSTRAINT','MY_TABLE','MY_SCHEMA')
as "constraints_ddl" from dual;
Is there an equivalent function to do the same in PostgreSQL?
I know there are ways via pg_dump and psql, but what I need is a way to do
so via SQL.
Thanks,
rik.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-03-19 22:26:41 | Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl |
Previous Message | Debraj Manna | 2023-03-19 09:02:23 | How to pass idle_session_timeout in postgres docker in a compose file? |