From 2131d4501f9472ed3714970e45485e5e892615e8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 19 Jul 2018 15:41:46 -0400 Subject: Remove undocumented restriction against duplicate partition key columns. transformPartitionSpec rejected duplicate simple partition columns (e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression columns, resulting in inconsistent behavior. Worse, cases like "PARTITION BY RANGE (x,(x))") were accepted but would then result in dump/reload failures, since the expression (x) would get simplified to a plain column later. There seems no better reason for this restriction than there was for the one against duplicate included index columns (cf commit 701fd0bbc), so let's just remove it. Back-patch to v10 where this code was added. Report and patch by Yugo Nagata. Discussion: https://postgr.es/m/20180712165939.36b12aff.nagata@sraoss.co.jp --- src/backend/commands/tablecmds.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 81c38450954..f4745f3a9a4 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -13223,21 +13223,6 @@ transformPartitionSpec(Relation rel, PartitionSpec *partspec, char *strategy) foreach(l, partspec->partParams) { PartitionElem *pelem = castNode(PartitionElem, lfirst(l)); - ListCell *lc; - - /* Check for PARTITION BY ... (foo, foo) */ - foreach(lc, newspec->partParams) - { - PartitionElem *pparam = castNode(PartitionElem, lfirst(lc)); - - if (pelem->name && pparam->name && - strcmp(pelem->name, pparam->name) == 0) - ereport(ERROR, - (errcode(ERRCODE_DUPLICATE_COLUMN), - errmsg("column \"%s\" appears more than once in partition key", - pelem->name), - parser_errposition(pstate, pelem->location))); - } if (pelem->expr) { -- cgit v1.2.3