aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-10-06 22:13:19 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-10-06 22:13:19 -0300
commit1c7f585b5c1a317bdbdf7d41c7ffab9968738149 (patch)
tree6ad910ec926edde3bf4cad3a9a01ffedc83afa48 /src/backend
parent1a852f7c1e27eef563cf0577c2604baec1be5512 (diff)
downloadpostgresql-1c7f585b5c1a317bdbdf7d41c7ffab9968738149.tar.gz
postgresql-1c7f585b5c1a317bdbdf7d41c7ffab9968738149.zip
Fix catalog insertion order for ATTACH PARTITION
Commit 2fbdf1b38bc changed the order in which we inserted catalog rows when creating partitions, so that we could remove an unsightly hack required for untimely relcache invalidations. However, that commit only changed the ordering for CREATE TABLE PARTITION OF, and left ALTER TABLE ATTACH PARTITION unchanged, so the latter can be affected when catalog invalidations occur, for instance when the partition key involves an SQL function. Reported-by: Rajkumar Raghuwanshi Author: Amit Langote Reviewed-by: Michaƫl Paquier Discussion: https://postgr.es/m/CAKcux6=nTz9KSfTr_6Z2mpzLJ_09JN-rK6=dWic6gGyTSWueyQ@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/commands/tablecmds.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 165db2044a8..32ed9186750 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -14191,9 +14191,6 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
trigger_name, RelationGetRelationName(attachrel)),
errdetail("ROW triggers with transition tables are not supported on partitions")));
- /* OK to create inheritance. Rest of the checks performed there */
- CreateInheritance(attachrel, rel);
-
/*
* Check that the new partition's bound is valid and does not overlap any
* of existing partitions of the parent - note that it does not return on
@@ -14202,6 +14199,9 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
check_new_partition_bound(RelationGetRelationName(attachrel), rel,
cmd->bound);
+ /* OK to create inheritance. Rest of the checks performed there */
+ CreateInheritance(attachrel, rel);
+
/* Update the pg_class entry. */
StorePartitionBound(attachrel, rel, cmd->bound);