postgresql/src/test/regress
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
..
data
expected Fix ALTER/TYPE on columns referenced by FKs in partitioned tables 2018-09-14 13:41:20 -03:00
input
output Error position support for defaults and check constraints 2018-08-30 08:20:23 +02:00
sql Fix ALTER/TYPE on columns referenced by FKs in partitioned tables 2018-09-14 13:41:20 -03:00
.gitignore
GNUmakefile
Makefile
parallel_schedule
pg_regress_main.c Clean up assorted misuses of snprintf()'s result value. 2018-08-15 16:29:31 -04:00
pg_regress.c Clean up assorted misuses of snprintf()'s result value. 2018-08-15 16:29:31 -04:00
pg_regress.h
README
regress.c
regressplans.sh
resultmap
serial_schedule
standby_schedule

Documentation concerning how to run these regression tests and interpret
the results can be found in the PostgreSQL manual, in the chapter
"Regression Tests".