Re: pg_dump new feature: exporting functions only. Bad or good idea ? - Mailing list pgsql-hackers

From Vik Fearing
Subject Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Date
Msg-id cd0a0c49-ce3b-91da-5916-3156b6b2d82e@postgresfriends.org
Whole thread Raw
In response to pg_dump new feature: exporting functions only. Bad or good idea ?  (Lætitia Avrot <laetitia.avrot@gmail.com>)
Responses Re: pg_dump new feature: exporting functions only. Bad or good idea ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 3/17/21 6:00 PM, Lætitia Avrot wrote:
> Hey hackers,
> 
> I had this idea, that I raised and cherished like my baby to add a switch
> in `pg_dump` to allow exporting stored functions (and procedures) only.
> 
> However, when I finally got the time to look at it in detail, I found out
> there was no way to solve the dependencies in the functions and procedures,
> so that the exported file, when re-played could lead to invalid objects.
> 
> So, I decided this would not make Postgres better and decide to walk off
> this patch.
> 
> Anyhow, when sharing my thoughts, several people told me to ask the
> community about adding this feature because this could be useful in some
> use cases. Another argument is that should you have all your functions in
> one schema and your tables in another, exporting only the function schema
> will lead to the same kind of file that could lead to invalid objects
> created when the file is re-played against a database that does not have
> the tables.
> 
> Of course, the documentation would add a warning against object invalidity
> should only the stored functions/procedures be exported.
> 
> So, my question is: what do you think about such a feature? is it worth it?

Yes, it is absolutely worth it to be able to extract just the functions
from a database.  I have wanted this several times.
-- 
Vik Fearing



pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: Index Skip Scan (new UniqueKeys)
Next
From: Tom Lane
Date:
Subject: Re: [patch] [doc] Minor variable related cleanup and rewording of plpgsql docs