Re: Re: pg_dump new feature: exporting functions only. Bad or good idea ?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
Cc: Chapman Flack <chap(at)anastigmatix(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vik Fearing <vik(at)postgresfriends(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Date: 2022-03-25 17:11:14
Message-ID: CAKFQuwZm7jRCRdSyLNh2EuU5b7OeUSpB3mmN0VBgTGBeiE0GzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 25, 2022 at 9:44 AM Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-03-25 17:29:32 Re: Run end-of-recovery checkpoint in non-wait mode or skip it entirely for faster server availability?
Previous Message Robert Haas 2022-03-25 16:56:38 Re: Run end-of-recovery checkpoint in non-wait mode or skip it entirely for faster server availability?