Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2409716

Browse files
committed
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 expressioncolumns, resulting in inconsistent behavior. Worse, cases like"PARTITION BY RANGE (x,(x))") were accepted but would then result indump/reload failures, since the expression (x) would get simplifiedto a plain column later.There seems no better reason for this restriction than there was forthe one against duplicate included index columns (cf commit701fd0b),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
1 parent90371a2 commit2409716

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13628,21 +13628,6 @@ transformPartitionSpec(Relation rel, PartitionSpec *partspec, char *strategy)
1362813628
foreach(l,partspec->partParams)
1362913629
{
1363013630
PartitionElem*pelem=castNode(PartitionElem,lfirst(l));
13631-
ListCell*lc;
13632-
13633-
/* Check for PARTITION BY ... (foo, foo) */
13634-
foreach(lc,newspec->partParams)
13635-
{
13636-
PartitionElem*pparam=castNode(PartitionElem,lfirst(lc));
13637-
13638-
if (pelem->name&&pparam->name&&
13639-
strcmp(pelem->name,pparam->name)==0)
13640-
ereport(ERROR,
13641-
(errcode(ERRCODE_DUPLICATE_COLUMN),
13642-
errmsg("column \"%s\" appears more than once in partition key",
13643-
pelem->name),
13644-
parser_errposition(pstate,pelem->location)));
13645-
}
1364613631

1364713632
if (pelem->expr)
1364813633
{

‎src/test/regress/expected/create_table.out

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,6 @@ CREATE TABLE partitioned (
288288
ERROR: exclusion constraints are not supported on partitioned tables
289289
LINE 3: EXCLUDE USING gist (a WITH &&)
290290
^
291-
-- prevent column from being used twice in the partition key
292-
CREATE TABLE partitioned (
293-
a int
294-
) PARTITION BY RANGE (a, a);
295-
ERROR: column "a" appears more than once in partition key
296291
-- prevent using prohibited expressions in the key
297292
CREATE FUNCTION retset (a int) RETURNS SETOF int AS $$ SELECT 1; $$ LANGUAGE SQL IMMUTABLE;
298293
CREATE TABLE partitioned (

‎src/test/regress/sql/create_table.sql

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,6 @@ CREATE TABLE partitioned (
303303
EXCLUDE USING gist (a WITH &&)
304304
) PARTITION BY RANGE (a);
305305

306-
-- prevent column from being used twice in the partition key
307-
CREATETABLEpartitioned (
308-
aint
309-
) PARTITION BY RANGE (a, a);
310-
311306
-- prevent using prohibited expressions in the key
312307
CREATEFUNCTIONretset (aint) RETURNS SETOFintAS $$SELECT1; $$ LANGUAGE SQL IMMUTABLE;
313308
CREATETABLEpartitioned (

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp