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

From David G. Johnston
Subject Re: Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Date
Msg-id CAKFQuwZm7jRCRdSyLNh2EuU5b7OeUSpB3mmN0VBgTGBeiE0GzA@mail.gmail.com
Whole thread Raw
In response to Re: Re: pg_dump new feature: exporting functions only. Bad or good idea ?  (Laetitia 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 Fri, Mar 25, 2022 at 9:44 AM Laetitia Avrot <laetitia.avrot@gmail.com> wrote:

Actually, I thought of it after the --schema-only flag (which is kind of confusing, because it won't export only schema creation DDL).

--schema-only is talking about the different sections of the dump file, not namespace schema objects in the database.
My problem is how do you think we could get all the stored procedures/functions at once? --function=* ? It seems to me that exporting everything at once is the main use case (I'd be happy to be proven wrong), and it does not feel intuitive to use --function=*.

How does one specify "all but only tables" today?  If the answer is "we don't" then we get to decide now.  I have no qualms with --objecttype=* meaning all.

(goes and checks)
pg_dump --schema-only -t '*'  # indeed outputs all relations.  Annoyingly, this seems to include pg_catalog relations as well, so one basically has to specify --exclude-table='pg_catalog.*' as well in the typical case of only wanting user objects.  Solving this with a new --no-system-objects that would apply firstly seems like a nice feature to this pre-existing behavior.  One might think that --exclude-schema='pg_catalog' would work, but it is doesn't by design.  The design choice seems solid for user-space schema names so just dealing with the system objects is my preferred solution.

I don't find the --objectype-only option to be desirable.  psql --tables-only --functions-only just seems odd, no longer are they "only".  I would go with --function-all (and maybe --function-system and --function-user) if going down this path but the wildcard feature can handle this just fine and we want that feature anyway.  Except succinctly omitting system objects which should get its own general option.

David J.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Run end-of-recovery checkpoint in non-wait mode or skip it entirely for faster server availability?
Next
From: Andres Freund
Date:
Subject: Re: Run end-of-recovery checkpoint in non-wait mode or skip it entirely for faster server availability?