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

From Ryan Lambert
Subject Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Date
Msg-id CAN-V+g9XCxp4yvv-1rh5x+XPRJk6ezoMKHX8hvCJo2P9sO4+Nw@mail.gmail.com
Whole thread Raw
In response to Re: 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 ?  (Lætitia Avrot <laetitia.avrot@gmail.com>)
List pgsql-hackers
On Sat, Mar 27, 2021 at 6:23 AM Lætitia Avrot <laetitia.avrot@gmail.com> wrote:
Hello,

You'll find enclosed the first version of my patch.

I tested a couple simple use cases.  This is great, Thank you!
 
I did not include the possibility of using a file to list tables to be exported as Tom suggested because I genuinely think it is a totally different matter. It does not mean I'm not open to the possibility, it just felt weird.

The patch allows using a `--functions-only` flag in `pg_dump` to export only functions and stored procedures. My code was build and passed tests on the last master branch of the PostgreSQL project. I added regression tests. Documentation has been updated too and generation of the documentation (HTML, man page, pdf in A4 and letter US format) has been tested successfully.

I did not add a warning in the documentation that the file provided might end up in a not restorable file or in a file restoring broken functions or procedures. Do you think I should?

The docs for both the --table and --schema options do warn about this.  On the other hand, --data-only has no such warning. I'd lean towards matching --data-only for this.
 

I don't know if this patch has any impact on performance. I guess that adding 4 if statements will slow down `pg_dump` a little bit.

Have a nice day,

Lætitia

Using --functions-only along with --table=<name> does not error out and warn the user, instead it creates a dump containing only the SET commands.  An error similar to using --functions-only along with --data-only seems like a good idea.

Cheers,

Ryan Lambert
RustProof Labs 

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Next
From: Alvaro Herrera
Date:
Subject: Re: [BUG] orphaned function