postgresql/src
Tom Lane 5b02d68e75 Fix ALTER TABLE's scheduling rules for AT_AddConstraint subcommands.
Commit 1281a5c90 rearranged the logic in this area rather drastically,
and it broke the case of adding a foreign key constraint in the same
ALTER that adds the pkey or unique constraint it depends on.  While
self-referential fkeys are surely a pretty niche case, this used to
work so we shouldn't break it.

To fix, reorganize the scheduling rules in ATParseTransformCmd so
that a transformed AT_AddConstraint subcommand will be delayed into
a later pass in all cases, not only when it's been spit out as a
side-effect of parsing some other command type.

Also tweak the logic so that we won't run ATParseTransformCmd twice
while doing this.  It seems to work even without that, but it's
surely wasting cycles to do so.

Per bug #16589 from Jeremy Evans.  Back-patch to v13 where the new
code was introduced.

Discussion: https://postgr.es/m/16589-31c8d981ca503896@postgresql.org
2020-08-22 12:34:17 -04:00
..
backend Fix ALTER TABLE's scheduling rules for AT_AddConstraint subcommands. 2020-08-22 12:34:17 -04:00
bin Avoid non-constant format string argument to fprintf(). 2020-08-18 13:13:09 +03:00
common Replace remaining StrNCpy() by strlcpy() 2020-08-10 23:20:37 +02:00
fe_utils Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:54 -07:00
include Fix handling of CREATE TABLE LIKE with inheritance. 2020-08-21 15:00:47 -04:00
interfaces Replace remaining StrNCpy() by strlcpy() 2020-08-10 23:20:37 +02:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Fix -Wcast-function-type warnings 2020-07-14 19:55:25 +02:00
port Remove optimization for RAND_poll() failing. 2020-07-25 14:50:59 -07:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Fix ALTER TABLE's scheduling rules for AT_AddConstraint subcommands. 2020-08-22 12:34:17 -04:00
timezone Ensure that distributed timezone abbreviation files are plain ASCII. 2020-07-17 11:03:55 -04:00
tools snapshot scalability: Move subxact info to ProcGlobal, remove PGXACT. 2020-08-14 15:33:35 -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