postgresql/src/backend
Alvaro Herrera 20bef2c311 Fix ALTER/TYPE on columns referenced by FKs in partitioned tables
When ALTER TABLE ... SET DATA TYPE affects a column referenced by
constraints and indexes, it drop those constraints and indexes and
recreates them afterwards, so that the definitions match the new data
type.  The original code did this by dropping one object at a time
(commit 077db40fa1 of May 2004), which worked fine because the
dependencies between the objects were pretty straightforward, and
ordering the objects in a specific way was enough to make this work.
However, when there are foreign key constraints in partitioned tables,
the dependencies are no longer so straightforward, and we were getting
errors when attempted:
  ERROR:  cache lookup failed for constraint 16398

This can be fixed by doing all the drops in one pass instead, using
performMultipleDeletions (introduced by df18c51f29 of Aug 2006).  With
this change we can also remove the code to carefully order the list of
objects to be deleted.

Reported-by: Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAKcux6nWS_m+s=1Udk_U9B+QY7pA-Ac58qR5BdUfOyrwnWHDew@mail.gmail.com
2018-09-14 13:41:20 -03:00
..
access Attach FPI to the first record after full_page_writes is turned on. 2018-09-13 15:32:50 +05:30
bootstrap Install a check for mis-linking of src/port and src/common functions. 2018-09-09 12:23:23 -04:00
catalog Simplify index tuple descriptor initialization 2018-09-13 08:22:03 +02:00
commands Fix ALTER/TYPE on columns referenced by FKs in partitioned tables 2018-09-14 13:41:20 -03:00
executor Save/restore SPI's global variables in SPI_connect() and SPI_finish(). 2018-09-07 20:09:57 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit LLVMJIT: LLVMGetHostCPUFeatures now is upstream, use LLMV version if available. 2018-08-24 10:21:38 -07:00
lib doc: Update redirecting links 2018-07-16 10:48:05 +02:00
libpq Minor cleanup/future-proofing for pg_saslprep(). 2018-09-08 18:20:36 -04:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Order active window clauses for greater reuse of Sort nodes. 2018-09-14 17:35:42 +01:00
optimizer Order active window clauses for greater reuse of Sort nodes. 2018-09-14 17:35:42 +01:00
parser Fully enforce uniqueness of constraint names. 2018-09-04 13:45:35 -04:00
partitioning Remove duplicated words split across lines in comments 2018-09-08 12:24:19 -07:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Refactor dlopen() support 2018-09-06 11:33:04 +02:00
postmaster Refactor dlopen() support 2018-09-06 11:33:04 +02:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Improve some error message strings and errcodes 2018-09-04 11:06:04 -07:00
rewrite Fix set of NLS translation issues 2018-08-21 15:17:13 +09:00
snowball Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
statistics Fix typos. 2018-08-27 09:32:59 +12:00
storage Remove duplicated words split across lines in comments 2018-09-08 12:24:19 -07:00
tcop Introduce minimal C99 usage to verify compiler support. 2018-08-23 18:36:07 -07:00
tsearch Hand code string to integer conversion for performance. 2018-07-22 14:58:23 -07:00
utils Repair bug in regexp split performance improvements. 2018-09-12 19:31:06 +01:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00