Re: [PATCH] Fix pg_dump --no-tablespaces for the custom format

Поиск
Список
Период
Сортировка
От Christopher Baines
Тема Re: [PATCH] Fix pg_dump --no-tablespaces for the custom format
Дата
Msg-id 877dxcny6a.fsf@cbaines.net
обсуждение исходный текст
Ответ на Re: [PATCH] Fix pg_dump --no-tablespaces for the custom format  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Fix pg_dump --no-tablespaces for the custom format  (Euler Taveira <euler.taveira@2ndquadrant.com>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Christopher Baines <mail@cbaines.net> writes:
>> So I'm new to poking around in the PostgreSQL code, so this is a bit of
>> a shot in the dark. I'm having some problems with pg_dump, and a
>> database with tablespaces. A couple of the tables are not in the default
>> tablespace, and I want to ignore this for the dump.
>
> I think you've misunderstood how the pieces fit together.  A lot of
> the detail-filtering switches, including --no-tablespaces, work on
> the output side of the "archive" format.  While you can't really tell
> the difference in pg_dump text mode, the implication for custom-format
> output is that the info is always there in the archive file, and you
> give the switch to pg_restore if you don't want to see the info.
> This is more flexible since you aren't compelled to make the decision
> up-front, and it doesn't really cost anything to include such info in
> the archive.  (Obviously, table-filtering switches don't work that
> way, since with those there can be a really large cost in file size
> to include unwanted data.)
>
> So from my perspective, things are working fine and this patch would
> break it.
>
> If you actually want to suppress this info from getting into the
> archive file, you'd have to give a very compelling reason for
> breaking this behavior for other people.

Thanks for getting back to me Tom :)

I don't really follow how having it do something more along the lines of
how it's documented would both be less flexible and break existing uses
of pg_dump. You're not prevented from including tablespace assignments,
just don't pass --no-tablespaces, and your now able to not include them
for the archive formats, just like the plain format, which in my view
increases the flexibility of the tool, since something new is possible.

I realise that for people who are passing --no-tablespaces, without
realising it does nothing combined with the archive formats, that
actually not including tablespace assignments will change the behaviour
for them, but as above, I'd see this as a positive change, as it makes
the tooling more powerful (and simpler to understand as well).

I see now that while the --help output doesn't capture the nuances:

  --no-tablespaces             do not dump tablespace assignments

The documentation does:

  --no-tablespaces

    Do not output commands to select tablespaces. With this option, all
    objects will be created in whichever tablespace is the default
    during restore.

    This option is only meaningful for the plain-text format. For the
    archive formats, you can specify the option when you call
    pg_restore.


Thanks again,

Chris

Вложения

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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Potentially misleading name of libpq pass phrase hook
Следующее
От: legrand legrand
Дата:
Сообщение: Re: Is it useful to record whether plans are generic or custom?