Re: Proposed patch: make pg_dump --data-only consider FK constraints - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposed patch: make pg_dump --data-only consider FK constraints
Date
Msg-id 20819.1220814653@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposed patch: make pg_dump --data-only consider FK constraints  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Proposed patch: make pg_dump --data-only consider FK constraints  (Gregory Stark <stark@enterprisedb.com>)
Re: Proposed patch: make pg_dump --data-only consider FK constraints  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Tom Lane wrote:
>> pg_dump: WARNING: circular foreign-key constraints among these table(s):
>> pg_dump:   master
>> pg_dump:   child
>> pg_dump: You may not be able to restore the dump without using --disable-triggers or temporarily dropping the
constraints.

> WARNING feels a bit too strong. I realize that that message isn't going 
> to the postmaster's log, bloating it, but if a user does that regularly, 
> always disabling triggers as instructed, or there is in fact never 
> circular references in the data with a particular schema, seeing that 
> big fat warning every time is going to become a bit tiresome. Perhaps 
> "NOTE: ..." ?

I doubt that very many people will ever see it at all, actually --- how
common are circular FK relationships?  And it does seem appropriate to
me for pg_dump to be noisy about the possibility of trouble at restore
time.  (Maybe the message should also suggest using a schema+data dump,
since that would be a solution at dump time?)

> How about printing that notice at the top of the dump file as well?

Hmm ... that might be feasible in plain text output, but I don't see
any easy way to get a similar effect in archive modes.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposed patch: make pg_dump --data-only consider FK constraints
Next
From: Tom Lane
Date:
Subject: Re: Proposed patch: make pg_dump --data-only consider FK constraints