From: | Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Vik Fearing <vik(at)postgresfriends(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_dump new feature: exporting functions only. Bad or good idea ? |
Date: | 2021-03-27 12:22:43 |
Message-ID: | CAB_COdjQ0ZkPtPMmBnEn-jhbasiZ_9LSi602RMMmp21SOyBaUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
You'll find enclosed the first version of my patch. 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?
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
Le mer. 17 mars 2021 à 18:16, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> a écrit :
> Vik Fearing <vik(at)postgresfriends(dot)org> writes:
> > On 3/17/21 6:00 PM, Lætitia Avrot wrote:
> >> 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, 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.
>
> Selective dumps always have a risk of not being restorable on their
> own; I don't see that "functions only" is noticeably less safe than
> "just these tables", or other cases that we support already.
>
> What I'm wondering about is how this might interact with the
> discussion at [1].
>
> regards, tom lane
>
> [1]
> https://www.postgresql.org/message-id/flat/CAFj8pRB10wvW0CC9Xq=1XDs=zCQxer3cbLcNZa+qiX4cUH-G_A(at)mail(dot)gmail(dot)com
>
Attachment | Content-Type | Size |
---|---|---|
pg_dump_functions_only_v0_1.patch | application/octet-stream | 7.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2021-03-27 12:57:36 | Re: pg_dump new feature: exporting functions only. Bad or good idea ? |
Previous Message | Laurenz Albe | 2021-03-27 10:41:07 | Re: public schema default ACL |