Re: pg_dump and pg_restore and foreign keys

From: Tore Halvorsen <tore(dot)halvorsen(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_dump and pg_restore and foreign keys
Date: 2021-10-29 05:57:18
Message-ID: CADGw-Sc1cFP3GaBhrXi9k+eoVHBmW0EQ-BRnOCsrFeRQNJvTGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In case someone else needs to do this - I ended up with this change in
pg_dump.c around lines 17080-17090

I guess a proper solution would check the already invalid foreign keys in a
different way.

appendPQExpBuffer(q, " ADD CONSTRAINT %s %s%s;\n",
fmtId(coninfo->dobj.name),
coninfo->condef
, dopt->foreign_keys_not_valid && !strstr(coninfo->condef, "NOT VALID") ? "
NOT VALID":"");

On Wed, Oct 27, 2021 at 4:08 PM Tore Halvorsen <tore(dot)halvorsen(at)gmail(dot)com>
wrote:

> Then I'll try that, thank you :)
>
> On Wed, Oct 27, 2021 at 4:04 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Tore Halvorsen <tore(dot)halvorsen(at)gmail(dot)com> writes:
>> > That would be appending it for "pg_catalog.pg_get_constraintdef(oid) AS
>> > condef" in getConstraints in pg_dump.c?
>>
>> No, you want to mess with the text printed by dumpConstraint().
>>
>> regards, tom lane
>>
>
>
> --
> Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul]
> <demo> Tore Halvorsen || +052 0553034554
>

--
Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul]
<demo> Tore Halvorsen || +052 0553034554

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2021-10-29 07:30:46 Re: Incremental backup
Previous Message Kyotaro Horiguchi 2021-10-29 01:44:46 Re: WAL File Recovery on Standby Server Stops Before End of WAL Files