Обсуждение: pg_dump vs data-only dumps vs --disable-triggers

Поиск
Список
Период
Сортировка

pg_dump vs data-only dumps vs --disable-triggers

От
Tom Lane
Дата:
There's some fairly squirrely logic in pg_dump/pg_restore that tries to
detect whether it's doing a data-only operation, ie, no schema
information is to be dumped or restored.  The reason it wants to
know this is to decide whether to enable the --disable-triggers
code.  However, since --disable-triggers is off by default and has
to be manually requested, I'm not sure why we've got all this extra
complexity in there.  (Actually, I'm sure the reason is that that
code predates the existence of the --disable-triggers switch, but
anyway...)

Simon's patch to split up --schema-only into two switches has broken
this logic, but I'm inclined to just rip it out rather than trying
to fix it.  If the user says --disable-triggers, he should get
trigger disable commands around the data part of the dump, no matter
what he said or didn't say about schema dumping.

Objections?
        regards, tom lane


Re: pg_dump vs data-only dumps vs --disable-triggers

От
Andrew Dunstan
Дата:

Tom Lane wrote:
> If the user says --disable-triggers, he should get
> trigger disable commands around the data part of the dump, no matter
> what he said or didn't say about schema dumping.
>
>   

Right. They seem like orthogonal issues.

cheers

andrew


Re: pg_dump vs data-only dumps vs --disable-triggers

От
Stephen Frost
Дата:
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Simon's patch to split up --schema-only into two switches has broken
> this logic, but I'm inclined to just rip it out rather than trying
> to fix it.  If the user says --disable-triggers, he should get
> trigger disable commands around the data part of the dump, no matter
> what he said or didn't say about schema dumping.

Agreed entirely.  I was suspicious of that bit of code but, honestly,
wasn't quite sure what the original intent had been.  Sorry I havn't
finished my review of his latest, he went and changed all the macro
names. ;)  If you're taking care of it then I won't spend any further
time on it..  I'm pretty comfortable with it now, honestly, provided the
renaming didn't change anything and my last set of comments were
included.
Thanks,
    Stephen

Re: pg_dump vs data-only dumps vs --disable-triggers

От
Simon Riggs
Дата:
On Thu, 2008-07-24 at 19:11 -0400, Tom Lane wrote:
> There's some fairly squirrely logic in pg_dump/pg_restore that tries to
> detect whether it's doing a data-only operation, ie, no schema
> information is to be dumped or restored.  The reason it wants to
> know this is to decide whether to enable the --disable-triggers
> code.  However, since --disable-triggers is off by default and has
> to be manually requested, I'm not sure why we've got all this extra
> complexity in there.  (Actually, I'm sure the reason is that that
> code predates the existence of the --disable-triggers switch, but
> anyway...)
> 
> Simon's patch to split up --schema-only into two switches has broken
> this logic, but I'm inclined to just rip it out rather than trying
> to fix it.  If the user says --disable-triggers, he should get
> trigger disable commands around the data part of the dump, no matter
> what he said or didn't say about schema dumping.

Agreed. Thanks for the clear thinking.

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support