1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Code review for c94e6942ce.

validateCheckConstraint() shouldn't try to access the storage for
a partitioned table, because it no longer has any.  Creating a
_RETURN table on a partitioned table shouldn't be allowed, both
because there's no value in it and because trying to do so would
involve a validation scan against its nonexistent storage.

Amit Langote, reviewed by Tom Lane.  Regression test outputs
updated to pass by me.

Discussion: http://postgr.es/m/e5c3cbd3-1551-d6f8-c9e2-51777d632fd2@lab.ntt.co.jp
This commit is contained in:
Robert Haas
2017-04-12 11:13:44 -04:00
parent b935eb7da3
commit 1d5fede4a9
6 changed files with 35 additions and 2 deletions

View File

@ -8120,8 +8120,12 @@ validateCheckConstraint(Relation rel, HeapTuple constrtup)
bool isnull;
Snapshot snapshot;
/* VALIDATE CONSTRAINT is a no-op for foreign tables */
if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
/*
* VALIDATE CONSTRAINT is a no-op for foreign tables and partitioned
* tables.
*/
if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE ||
rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
return;
constrForm = (Form_pg_constraint) GETSTRUCT(constrtup);