postgresql/src/test/regress
Tom Lane a0555ddab9 Install dependencies to prevent dropping partition key columns.
The logic in ATExecDropColumn that rejects dropping partition key
columns is quite an inadequate defense, because it doesn't execute
in cases where a column needs to be dropped due to cascade from
something that only the column, not the whole partitioned table,
depends on.  That leaves us with a badly broken partitioned table;
even an attempt to load its relcache entry will fail.

We really need to have explicit pg_depend entries that show that the
column can't be dropped without dropping the whole table.  Hence,
add those entries.  In v12 and HEAD, bump catversion to ensure that
partitioned tables will have such entries.  We can't do that in
released branches of course, so in v10 and v11 this patch affords
protection only to partitioned tables created after the patch is
installed.  Given the lack of field complaints (this bug was found
by fuzz-testing not by end users), that's probably good enough.

In passing, fix ATExecDropColumn and ATPrepAlterColumnType
messages to be more specific about which partition key column
they're complaining about.

Per report from Manuel Rigger.  Back-patch to v10 where partitioned
tables were added.

Discussion: https://postgr.es/m/CA+u7OA4JKCPFrdrAbOs7XBiCyD61XJxeNav4LefkSmBLQ-Vobg@mail.gmail.com
Discussion: https://postgr.es/m/31920.1562526703@sss.pgh.pa.us
2019-07-22 14:55:40 -04:00
..
data
expected Install dependencies to prevent dropping partition key columns. 2019-07-22 14:55:40 -04:00
input Fix handling of COMMENT for domain constraints 2019-06-12 11:30:11 +09:00
output Fix handling of COMMENT for domain constraints 2019-06-12 11:30:11 +09:00
sql Install dependencies to prevent dropping partition key columns. 2019-07-22 14:55:40 -04:00
.gitignore
GNUmakefile Move logging.h and logging.c from src/fe_utils/ to src/common/. 2019-05-14 14:20:10 -04:00
Makefile
parallel_schedule Move rolenames test out of the core regression tests. 2019-06-30 12:51:12 -04:00
pg_regress_main.c
pg_regress.c Revert "initdb: Change authentication defaults" 2019-07-22 19:28:25 +02:00
pg_regress.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
README
regress.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
regressplans.sh Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
resultmap
serial_schedule Move rolenames test out of the core regression tests. 2019-06-30 12:51:12 -04:00
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".