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

Поиск
Список
Период
Сортировка
От Lætitia Avrot
Тема Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Дата
Msg-id CAB_COdjQ0ZkPtPMmBnEn-jhbasiZ_9LSi602RMMmp21SOyBaUA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_dump new feature: exporting functions only. Bad or good idea ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_dump new feature: exporting functions only. Bad or good idea ?  (Andrew Dunstan <andrew@dunslane.net>)
Re: pg_dump new feature: exporting functions only. Bad or good idea ?  (Ryan Lambert <ryan@rustprooflabs.com>)
Список 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@sss.pgh.pa.us> a écrit :
Vik Fearing <vik@postgresfriends.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@mail.gmail.com
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: public schema default ACL
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pg_dump new feature: exporting functions only. Bad or good idea ?