Re: Proposed patch: make pg_dump --data-only consider FK constraints

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Proposed patch: make pg_dump --data-only consider FK constraints
Date: 2008-09-07 19:04:48
Message-ID: 20080907190448.GD3975@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:
> 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: ..." ?

But the warning is only going to be emitted if there are actual circular
FK constraints, so it seems OK.

> How about printing that notice at the top of the dump file as well? Most
> people probably don't look at the dump files, but if someone needs to
> deal with a data-only dumps that contain circular constraints, and also
> those that don't, it would be invaluable information.

I assume that this trick will only work at restore time only for custom
or tar dumps. A text-only dump would produce the warning to stderr at
dump time, no?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-07 19:06:26 Re: Proposed patch: make pg_dump --data-only consider FK constraints
Previous Message David Fetter 2008-09-07 18:52:40 Re: Proposed patch: make pg_dump --data-only consider FK constraints