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

Commita222f7f

Browse files
committed
Remove broken code that tried to handle OVERLAPS with a single argument.
The SQL standard says that OVERLAPS should have a two-element rowconstructor on each side. The original coding of OVERLAPS support inour grammar attempted to extend that by allowing a single-element rowconstructor, which it internally duplicated ... or tried to, anyway.But that code has certainly not worked since our List infrastructure wasrewritten in 2004, and I'm none too sure it worked before that. As itstands, it ends up building a List that includes itself, leading toassorted undesirable behaviors later in the parser.Even if it worked as intended, it'd be a bit evil because of thepossibility of duplicate evaluation of a volatile function that the userhad written only once. Given the lack of documentation, test cases, orcomplaints, let's just get rid of the idea and only support the standardsyntax.While we're at it, improve the error cursor positioning for thewrong-number-of-arguments errors, and inline the makeOverlaps() functionsince it's only called in one place anyway.Per bug #9227 from Joshua Yanovski. Initial patch by Joshua Yanovski,extended a bit by me.
1 parent7f3e17b commita222f7f

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

‎src/backend/parser/gram.y

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ static Node *makeBitStringConst(char *str, int location);
136136
static Node *makeNullAConst(int location);
137137
static Node *makeAConst(Value *v,int location);
138138
static Node *makeBoolAConst(bool state,int location);
139-
static FuncCall *makeOverlaps(List *largs, List *rargs,
140-
int location,core_yyscan_t yyscanner);
141139
staticvoidcheck_qualified_name(List *names,core_yyscan_t yyscanner);
142140
static List *check_func_name(List *names,core_yyscan_t yyscanner);
143141
static List *check_indirection(List *indirection,core_yyscan_t yyscanner);
@@ -10949,7 +10947,19 @@ a_expr:c_expr{ $$ = $1; }
1094910947
}
1095010948
|rowOVERLAPSrow
1095110949
{
10952-
$$ = (Node *)makeOverlaps($1,$3,@2, yyscanner);
10950+
if (list_length($1) !=2)
10951+
ereport(ERROR,
10952+
(errcode(ERRCODE_SYNTAX_ERROR),
10953+
errmsg("wrong number of parameters on left side of OVERLAPS expression"),
10954+
parser_errposition(@1)));
10955+
if (list_length($3) !=2)
10956+
ereport(ERROR,
10957+
(errcode(ERRCODE_SYNTAX_ERROR),
10958+
errmsg("wrong number of parameters on right side of OVERLAPS expression"),
10959+
parser_errposition(@3)));
10960+
$$ = (Node *) makeFuncCall(SystemFuncName("overlaps"),
10961+
list_concat($1, $3),
10962+
@2);
1095310963
}
1095410964
|a_exprISTRUE_P%precIS
1095510965
{
@@ -13397,31 +13407,6 @@ makeBoolAConst(bool state, int location)
1339713407
return makeTypeCast((Node *)n, SystemTypeName("bool"), -1);
1339813408
}
1339913409

13400-
/* makeOverlaps()
13401-
* Create and populate a FuncCall node to support the OVERLAPS operator.
13402-
*/
13403-
static FuncCall *
13404-
makeOverlaps(List *largs, List *rargs, int location, core_yyscan_t yyscanner)
13405-
{
13406-
FuncCall *n;
13407-
if (list_length(largs) == 1)
13408-
largs = lappend(largs, largs);
13409-
else if (list_length(largs) != 2)
13410-
ereport(ERROR,
13411-
(errcode(ERRCODE_SYNTAX_ERROR),
13412-
errmsg("wrong number of parameters on left side of OVERLAPS expression"),
13413-
parser_errposition(location)));
13414-
if (list_length(rargs) == 1)
13415-
rargs = lappend(rargs, rargs);
13416-
else if (list_length(rargs) != 2)
13417-
ereport(ERROR,
13418-
(errcode(ERRCODE_SYNTAX_ERROR),
13419-
errmsg("wrong number of parameters on right side of OVERLAPS expression"),
13420-
parser_errposition(location)));
13421-
n = makeFuncCall(SystemFuncName("overlaps"), list_concat(largs, rargs), location);
13422-
return n;
13423-
}
13424-
1342513410
/* check_qualified_name --- check the result of qualified_name production
1342613411
*
1342713412
* It's easiest to let the grammar production for qualified_name allow

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp