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

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
Date: 2023-03-20 14:30:02
Message-ID: e26607cb-0591-e5d1-cf5b-4cefb627f91e@jakobs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Am 20.03.23 um 15:02 schrieb richard coleman:
> Holger,
>
> Thanks, but I was looking for a SQL callable function(s), analogous to
> the Oracle  dbms_metadata.get_ddl() &
> dbms_metadata.get_dependent_ddl() functions that return DDL in plain
> text from an SQL query.
>
> It appears that PostgreSQL doesn't have that ability, at least not as
> a built-in function and with the suggestions of others on this list
> I'll have to write my own.
>
> Thanks again,
> rik.
>
Rik,

But you realize that on the other hand a PostgreSQL user switching to
Oracle could say:

"It appears that Oracle lacks PostgreSQL's proprietary views showing the
structure of the database."

Actually, nothing besides the ISO standard INFORMATION SCHEMA is in any
way standardised. The SQL standard is not comprehensive here and leaves
a lot to the implementor.

It's not difficult to write table-valued functions returning the DDL of
database objects, but it's a lot of work.

Regards,

Holger

--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2023-03-20 14:36:15 Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl
Previous Message MichaelDBA 2023-03-20 14:06:07 Re: PostgreSQL equivalents to dbms_metadata.get_ddl & dbms_metadata.get_dependent_ddl