pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DDLs of a Function
5+ messages / 3 participants
[nested] [flat]

* DDLs of a Function
@ 2019-12-17 05:00 pratmeht <pratikmehta28@gmail.com>
  2019-12-17 05:39 ` Re: DDLs of a Function Omkar Dhorge <omkardhorge@gmail.com>
  2019-12-17 13:00 ` Re: DDLs of a Function Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 2 replies; 5+ messages in thread

From: pratmeht @ 2019-12-17 05:00 UTC (permalink / raw)
  To: pgsql-admin

Hi Postgres Community,

We want to drop a table and recreate it. As we all know, dropping a table
even drops the dependent objects like views, MVs, functions. I wanted your
help to get the DDL of the (dependent) function before we can drop the
table. Once the dropped table is being recreated, this DDL will be helpful
to recreate that function.

We found a way to get the DDL of the Views and MVs, but not for function! :(
Can someone please help ?

Regards,
Pratik Mehta



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DDLs of a Function
  2019-12-17 05:00 DDLs of a Function pratmeht <pratikmehta28@gmail.com>
@ 2019-12-17 05:39 ` Omkar Dhorge <omkardhorge@gmail.com>
  2019-12-19 05:02   ` Re: DDLs of a Function pratmeht <pratikmehta28@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Omkar Dhorge @ 2019-12-17 05:39 UTC (permalink / raw)
  To: pratmeht <pratikmehta28@gmail.com>; +Cc: pgsql-admin

Hello Pratik,

There is a open source db client 'dbeaver'

You can use this to get the DDLs for the functions.

Attached is the screenshot for your reference,





On Tue, 17 Dec, 2019, 10:30 AM pratmeht, <pratikmehta28@gmail.com> wrote:

> Hi Postgres Community,
>
> We want to drop a table and recreate it. As we all know, dropping a table
> even drops the dependent objects like views, MVs, functions. I wanted your
> help to get the DDL of the (dependent) function before we can drop the
> table. Once the dropped table is being recreated, this DDL will be helpful
> to recreate that function.
>
> We found a way to get the DDL of the Views and MVs, but not for function!
> :(
> Can someone please help ?
>
> Regards,
> Pratik Mehta
>
>
>
> --
> Sent from:
> https://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html
>
>
>

Attachments:

image001.png (image/png, 67.5K) download view image
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: DDLs of a Function
  2019-12-17 05:00 DDLs of a Function pratmeht <pratikmehta28@gmail.com>
  2019-12-17 05:39 ` Re: DDLs of a Function Omkar Dhorge <omkardhorge@gmail.com>
@ 2019-12-19 05:02   ` pratmeht <pratikmehta28@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: pratmeht @ 2019-12-19 05:02 UTC (permalink / raw)
  To: pgsql-admin

Hi Omkar,

Thank you so much for your reply. I will check and let you know how it goes.

Regards,
Pratik



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DDLs of a Function
  2019-12-17 05:00 DDLs of a Function pratmeht <pratikmehta28@gmail.com>
@ 2019-12-17 13:00 ` Laurenz Albe <laurenz.albe@cybertec.at>
  2019-12-19 05:01   ` Re: DDLs of a Function pratmeht <pratikmehta28@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Laurenz Albe @ 2019-12-17 13:00 UTC (permalink / raw)
  To: pratmeht <pratikmehta28@gmail.com>; pgsql-admin

On Mon, 2019-12-16 at 22:00 -0700, pratmeht wrote:
> We want to drop a table and recreate it. As we all know, dropping a table
> even drops the dependent objects like views, MVs, functions. I wanted your
> help to get the DDL of the (dependent) function before we can drop the
> table. Once the dropped table is being recreated, this DDL will be helpful
> to recreate that function.
> 
> We found a way to get the DDL of the Views and MVs, but not for function! :(
> Can someone please help ?

You can use "pg_get_functiondef":

SELECT pg_get_functiondef('pg_get_functiondef'::regproc);

                      pg_get_functiondef                       
---------------------------------------------------------------
 CREATE OR REPLACE FUNCTION pg_catalog.pg_get_functiondef(oid)+
  RETURNS text                                                +
  LANGUAGE internal                                           +
  STABLE PARALLEL SAFE STRICT                                 +
 AS $function$pg_get_functiondef$function$                    +
 
(1 row)

This article contains something about view dependencies:
https://www.cybertec-postgresql.com/en/tracking-view-dependencies-in-postgresql/

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DDLs of a Function
  2019-12-17 05:00 DDLs of a Function pratmeht <pratikmehta28@gmail.com>
  2019-12-17 13:00 ` Re: DDLs of a Function Laurenz Albe <laurenz.albe@cybertec.at>
@ 2019-12-19 05:01   ` pratmeht <pratikmehta28@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: pratmeht @ 2019-12-19 05:01 UTC (permalink / raw)
  To: pgsql-admin

Hi Laurenz,

Thank you so much for your reply. I will check then and let you know how it
goes.

Regards,
Pratik



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2019-12-19 05:02 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 05:00 DDLs of a Function pratmeht <pratikmehta28@gmail.com>
2019-12-17 05:39 ` Omkar Dhorge <omkardhorge@gmail.com>
2019-12-19 05:02   ` pratmeht <pratikmehta28@gmail.com>
2019-12-17 13:00 ` Laurenz Albe <laurenz.albe@cybertec.at>
2019-12-19 05:01   ` pratmeht <pratikmehta28@gmail.com>

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