Re: pg_dump quietly ignore missing tables - is it bug?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: pg_dump quietly ignore missing tables - is it bug?
Дата
Msg-id CAKFQuwb1ae4S3XRS4B5c9AnV09snsHJzqVgXcgFNjsyxB+U6bw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_dump quietly ignore missing tables - is it bug?  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Fri, Mar 13, 2015 at 10:01 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:


2015-03-13 17:39 GMT+01:00 Robert Haas <robertmhaas@gmail.com>:
On Fri, Mar 13, 2015 at 11:26 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> we found possible bug in pg_dump. It raise a error only when all specified
> tables doesn't exists. When it find any table, then ignore missing other.
>
> /usr/local/pgsql/bin/pg_dump -t Foo -t omega -s postgres > /dev/null; echo
> $?
>
> foo doesn't exists - it creates broken backup due missing "Foo" table
>
>  [pavel@localhost include]$ /usr/local/pgsql/bin/pg_dump -t Foo -t omegaa -s
> postgres > /dev/null; echo $?
> pg_dump: No matching tables were found
> 1
>
> Is it ok? I am thinking, so it is potentially dangerous. Any explicitly
> specified table should to exists.

Keep in mind that the argument to -t is a pattern, not just a table
name.  I'm not sure how much that affects the calculus here, but it's
something to think about.

yes, it has a sense, although now, I am don't think so it was a good idea. There should be some difference between table name and table pattern.


​There is...a single table name is simply expressed as a pattern without any wildcards.  The issue here is that pg_dump doesn't require that every instance of -t find one (or more, if a wildcard is present) entries only that at least one entry is found among all of the patterns specified by -t​.

I'll voice my agreement that each of the -t specifications should find at least one table in order for the dump as a whole to succeed; though depending on presented use cases for the current behavior I could see allowing the command writer to specify a more lenient interpretation by specifying something like --allow-missing-tables.

Command line switch formats don't really allow you to write "-t?​" to mean "I want these table(s) if present", do they?  I guess the input itself could be interpreted that way though; a leading "?" is not a valid wildcard and double-quotes would be required for it to be a valid table name.

David J.

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

Предыдущее
От: Arthur Silva
Дата:
Сообщение: Paper from IBM: Memory-Efficient Hash Joins
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)