Re: pg_dump and pg_restore and foreign keys

2021-10-28 Thread Tore Halvorsen
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 , d

Re: pg_dump and pg_restore and foreign keys

2021-10-27 Thread Tore Halvorsen
Then I'll try that, thank you :) On Wed, Oct 27, 2021 at 4:04 PM Tom Lane wrote: > Tore Halvorsen 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().

Re: pg_dump and pg_restore and foreign keys

2021-10-27 Thread Tom Lane
Tore Halvorsen 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

Re: pg_dump and pg_restore and foreign keys

2021-10-27 Thread Tore Halvorsen
That would be appending it for "pg_catalog.pg_get_constraintdef(oid) AS condef" in getConstraints in pg_dump.c? On Wed, Oct 27, 2021 at 3:27 PM Tom Lane wrote: > Tore Halvorsen writes: > > I'm trying to restore a database where adding foreign key constraints > takes > > most of the time. Does

Re: pg_dump and pg_restore and foreign keys

2021-10-27 Thread Tom Lane
Tore Halvorsen writes: > I'm trying to restore a database where adding foreign key constraints takes > most of the time. Does there exist a simple way to make either pg_dump or > pg_restore handle them as "not valid", and defer the validation. No. It's kind of a neat idea perhaps, but it's not t