diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-04-12 11:13:44 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-04-12 11:35:11 -0400 |
commit | 1d5fede4a900d135745c1fa5a70dcfe0b3359e3d (patch) | |
tree | 620b3a368e148c593da95dd2bbed8f63656c723a /src/backend/commands/tablecmds.c | |
parent | b935eb7da37254a18c48acc7b07517c8dfbb2339 (diff) | |
download | postgresql-1d5fede4a900d135745c1fa5a70dcfe0b3359e3d.tar.gz postgresql-1d5fede4a900d135745c1fa5a70dcfe0b3359e3d.zip |
Code review for c94e6942cefe7d20c5feed856e27f672734b1e2b.
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
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index a6a9f54b13e..a02904c85c9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -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); |