postgresql/src
Alvaro Herrera b7cc21c57d
pg_dump: fix dependencies on FKs to partitioned tables
Parallel-restoring a foreign key that references a partitioned table
with several levels of partitions can fail:

pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 6684; 2606 29166 FK CONSTRAINT fk fk_a_fkey postgres
pg_restore: error: could not execute query: ERROR:  there is no unique constraint matching given keys for referenced table "pk"
Command was: ALTER TABLE fkpart3.fk
    ADD CONSTRAINT fk_a_fkey FOREIGN KEY (a) REFERENCES fkpart3.pk(a);

This happens in parallel restore mode because some index partitions
aren't yet attached to the topmost partitioned index that the FK uses,
and so the index is still invalid.  The current code marks the FK as
dependent on the first level of index-attach dump objects; the bug is
fixed by recursively marking the FK on their children.

Backpatch to 12, where FKs to partitioned tables were introduced.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/3170626.1594842723@sss.pgh.pa.us
Backpatch: 12-master
2020-08-14 17:33:31 -04:00
..
backend Fix postmaster's behavior during smart shutdown. 2020-08-14 13:26:57 -04:00
bin pg_dump: fix dependencies on FKs to partitioned tables 2020-08-14 17:33:31 -04:00
common Move frontend-side archive APIs from src/common/ to src/fe_utils/ 2020-06-11 15:48:56 +09:00
fe_utils Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:58 -07:00
include Fix postmaster's behavior during smart shutdown. 2020-08-14 13:26:57 -04:00
interfaces Translation updates 2020-08-10 15:15:50 +02:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Translation updates 2020-08-10 15:15:50 +02:00
port Clear some style deviations. 2020-05-21 08:31:16 -07:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Fix typo in test comment. 2020-08-14 10:41:06 +03:00
timezone Ensure that distributed timezone abbreviation files are plain ASCII. 2020-07-17 11:04:22 -04:00
tools Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:58 -07:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Update Unicode data to Unicode 13.0.0 and CLDR 37 2020-04-24 09:52:59 +02:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00