Thread: pg_dump superflous warning message

pg_dump superflous warning message

From
Bill Moran
Date:
If I do:
pg_dump -a --disable-triggers

I get a warning message:
pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
pg_dump:   directory
pg_dump: You may not be able to restore the dump without using --disable-triggers or temporarily dropping the
constraints.
pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.

Of course, this was confusing as hell -- we spent a good bit of time
trying to figure out why pg_dump wasn't honoring --disable-triggers.

It turns out that it is, it's just that it prints the warning even
when it's not applicable.

At least from my perspective, I don't think this warning should be
printed if the proper command line switches have been given.  Is there
a good reason to print it anyway?

This is with pg 8.4.2 (both client and server).

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

Re: pg_dump superflous warning message

From
Scott Marlowe
Date:
On Thu, Feb 11, 2010 at 10:08 AM, Bill Moran <wmoran@potentialtech.com> wrote:
>
> If I do:
> pg_dump -a --disable-triggers
>
> I get a warning message:
> pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
> pg_dump:   directory
> pg_dump: You may not be able to restore the dump without using --disable-triggers or temporarily dropping the
constraints.
> pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.
>
> Of course, this was confusing as hell -- we spent a good bit of time
> trying to figure out why pg_dump wasn't honoring --disable-triggers.
>
> It turns out that it is, it's just that it prints the warning even
> when it's not applicable.

But it's not a warning, it's a NOTICE.

Re: pg_dump superflous warning message

From
Tom Lane
Date:
Bill Moran <wmoran@potentialtech.com> writes:
> If I do:
> pg_dump -a --disable-triggers

> I get a warning message:
> pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
> pg_dump:   directory
> pg_dump: You may not be able to restore the dump without using --disable-triggers or temporarily dropping the
constraints.
> pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.

> Of course, this was confusing as hell -- we spent a good bit of time
> trying to figure out why pg_dump wasn't honoring --disable-triggers.

> It turns out that it is, it's just that it prints the warning even
> when it's not applicable.

Yeah, the low-level routine that prints the warning doesn't have ready
access to knowledge of whether that switch has been given.  I'm not
sure it's worth doing anything about it, considering all the different
corner cases involved (in particular text vs archive output).  It'd
be way too easy to suppress the message in cases where it was actually
relevant :-(

            regards, tom lane

Re: pg_dump superflous warning message

From
Bill Moran
Date:
In response to Scott Marlowe <scott.marlowe@gmail.com>:

> On Thu, Feb 11, 2010 at 10:08 AM, Bill Moran <wmoran@potentialtech.com> wrote:
> >
> > If I do:
> > pg_dump -a --disable-triggers
> >
> > I get a warning message:
> > pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
> > pg_dump:   directory
> > pg_dump: You may not be able to restore the dump without using --disable-triggers or temporarily dropping the
constraints.
> > pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.
> >
> > Of course, this was confusing as hell -- we spent a good bit of time
> > trying to figure out why pg_dump wasn't honoring --disable-triggers.
> >
> > It turns out that it is, it's just that it prints the warning even
> > when it's not applicable.
>
> But it's not a warning, it's a NOTICE.

Point taken.  However, it's still a message that pops up and confuses
the user by making him think he did something wrong.

Based on Tom's response, it's probably not worth changing, but it would
be nice if there was a reasonable way to detect when it was necessary
and when it wasn't.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/