public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: vaibhave postgres <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: pg_restore: fails to restore post-data items due to circular FK deadlock
Date: Thu, 30 May 2024 11:29:29 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAM_eQjwLbRsdPF2=Yip05QNb-tyb2LXkAqfSkuVKpZRNhRmJmA@mail.gmail.com>
References: <CAM_eQjwLbRsdPF2=Yip05QNb-tyb2LXkAqfSkuVKpZRNhRmJmA@mail.gmail.com>
vaibhave postgres <[email protected]> writes:
> 1. Create a database which has circular foreign key dependencies. (or use
> the sql script which I have shared), restore the pre-data section first.
> 2. pg_dump -Fc *--section=post-data*
> 3. pg_restore --jobs > 1
> pg_restore fails to record the dependency between the foreign keys and
> tries to process them in parallel (see the attached log file for details)
The reason this works in other cases is that pg_restore recognizes
that two ADD CONSTRAINT steps shouldn't be run concurrently when they
have dependencies on the same table(s). However, when you use
--section=post-data to create the dump file, there are no entries for
the tables.
So this seems like a "don't do that" case. You could get the results
you want by using --schema-only at dump time and then using
--section=post-data as a pg_restore switch. (That'd also avoid the
need to make two separate dump files.)
Possibly we should add something to the docs about this.
regards, tom lane
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: pg_restore: fails to restore post-data items due to circular FK deadlock
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox