Re: pg_dumpall --exclude-database option

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: pg_dumpall --exclude-database option
Дата
Msg-id alpine.DEB.2.21.1810131525000.12620@lancre
обсуждение исходный текст
Ответ на Re: pg_dumpall --exclude-database option  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Ответы Re: pg_dumpall --exclude-database option
Список pgsql-hackers
Hello Andrew,

>> A question: would it makes sense to have a symmetrical 
>> --include-database=PATTERN option as well?
>
> I don't think so. If you only want a few databases, just use pg_dump. The 
> premise of pg_dumpall is that you want all of them and this switch provides 
> for exceptions to that.

Ok, sounds reasonable.

>> Somehow the option does not make much sense when under -g/-r/-t... maybe it 
>> should complain, like it does when the others are used together?
>
> Added an error check.

Ok.

>> ISTM that it would have been better to issue just one query with an OR 
>> list, but that would require to extend "processSQLNamePattern" a little 
>> bit. Not sure whether it is worth it.
>
> I don't think it is. This uses the same pattern that is used in pg_dump.c for 
> similar switches.

Ok.

> revised patch attached.

Patch applies cleanly, compiles, make check ok, pg_dump tap tests ok, doc 
build ok.

Very minor comments:

Missing space after comma:

  + {"exclude-database",required_argument, NULL, 5},

Now that C99 is okay, ISTM that both for loops in expand_dbname_patterns 
could benefit from using loop-local variables:

   for (SimpleStringListCell *cell = ...
   for (int i = ...

About the documentation:

    "When using wildcards, be careful to quote the pattern if needed to prevent
     the shell from expanding the wildcards."

I'd suggest to consider simplifying the end, maybe "to prevent shell 
wildcard expansion".

The feature is not tested per se. Maybe one existing tap test could be 
extended with minimal fuss to use it, eg --exclude-database='[a-z]*' 
should be close to only keeping the global stuff? I noticed an "exclude 
table" test already exists.

-- 
Fabien.


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgsql: Add TAP tests for pg_verify_checksums
Следующее
От: "Jung, Jinho"
Дата:
Сообщение: Regarding query minimizer (simplifier)