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

Commit96c7381

Browse files
committed
Fix error message in check_partition_bounds_for_split_range()
Currently, the error message is produced by a system of complex substitutionsmaking it quite untranslatable and hard to read. This commit splits this into4 plain error messages suitable for translation.Reported-by: Kyotaro HoriguchiDiscussion:https://postgr.es/m/20240408.152402.1485994009160660141.horikyota.ntt%40gmail.comReviewed-by: Pavel Borisov
1 parentfcf80c5 commit96c7381

File tree

1 file changed

+49
-21
lines changed

1 file changed

+49
-21
lines changed

‎src/backend/partitioning/partbounds.c

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5211,7 +5211,7 @@ check_partition_bounds_for_split_range(Relation parent,
52115211
if (first||last)
52125212
{
52135213
PartitionBoundSpec*split_spec=get_partition_bound_spec(splitPartOid,splitPartName);
5214-
booloverlap= false;
5214+
PartitionRangeDatum*datum;
52155215

52165216
if (first)
52175217
{
@@ -5229,8 +5229,30 @@ check_partition_bounds_for_split_range(Relation parent,
52295229
* Lower bound of "spec" should be equal (or greater than or equal
52305230
* in case defaultPart=true) to lower bound of split partition.
52315231
*/
5232-
if ((!defaultPart&&cmpval)|| (defaultPart&&cmpval<0))
5233-
overlap= true;
5232+
if (!defaultPart)
5233+
{
5234+
if (cmpval!=0)
5235+
{
5236+
datum=list_nth(spec->lowerdatums,abs(cmpval)-1);
5237+
ereport(ERROR,
5238+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
5239+
errmsg("lower bound of partition \"%s\" is not equal to lower bound of split partition",
5240+
relname),
5241+
parser_errposition(pstate,datum->location)));
5242+
}
5243+
}
5244+
else
5245+
{
5246+
if (cmpval<0)
5247+
{
5248+
datum=list_nth(spec->lowerdatums,abs(cmpval)-1);
5249+
ereport(ERROR,
5250+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
5251+
errmsg("lower bound of partition \"%s\" is less than lower bound of split partition",
5252+
relname),
5253+
parser_errposition(pstate,datum->location)));
5254+
}
5255+
}
52345256
}
52355257
else
52365258
{
@@ -5248,24 +5270,30 @@ check_partition_bounds_for_split_range(Relation parent,
52485270
* Upper bound of "spec" should be equal (or less than or equal in
52495271
* case defaultPart=true) to upper bound of split partition.
52505272
*/
5251-
if ((!defaultPart&&cmpval)|| (defaultPart&&cmpval>0))
5252-
overlap= true;
5253-
}
5254-
5255-
if (overlap)
5256-
{
5257-
PartitionRangeDatum*datum;
5258-
5259-
datum=list_nth(first ?spec->lowerdatums :spec->upperdatums,abs(cmpval)-1);
5260-
5261-
ereport(ERROR,
5262-
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
5263-
errmsg("%s bound of partition \"%s\" is %s %s bound of split partition",
5264-
first ?"lower" :"upper",
5265-
relname,
5266-
defaultPart ? (first ?"less than" :"greater than") :"not equal to",
5267-
first ?"lower" :"upper"),
5268-
parser_errposition(pstate,datum->location)));
5273+
if (!defaultPart)
5274+
{
5275+
if (cmpval!=0)
5276+
{
5277+
datum=list_nth(spec->upperdatums,abs(cmpval)-1);
5278+
ereport(ERROR,
5279+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
5280+
errmsg("upper bound of partition \"%s\" is not equal to upper bound of split partition",
5281+
relname),
5282+
parser_errposition(pstate,datum->location)));
5283+
}
5284+
}
5285+
else
5286+
{
5287+
if (cmpval>0)
5288+
{
5289+
datum=list_nth(spec->upperdatums,abs(cmpval)-1);
5290+
ereport(ERROR,
5291+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
5292+
errmsg("upper bound of partition \"%s\" is greater than upper bound of split partition",
5293+
relname),
5294+
parser_errposition(pstate,datum->location)));
5295+
}
5296+
}
52695297
}
52705298
}
52715299
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp