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

Commit01e0cbc

Browse files
committed
Fix YA unwanted behavioral difference with operator_precedence_warning.
Jeff Janes noted that the error cursor position shown for some errorswould vary when operator_precedence_warning is turned on. We'd preferthat option to have no undocumented effects, so this isn't desirable.To fix, make sure that an AEXPR_PAREN node has the same exprLocationas its child node.(Note: it would be a little cheaper to use@2 here instead of anexprLocation call, but there are cases where that wouldn't producethe identical answer, so don't do it like that.)Back-patch to 9.5 where this feature was introduced.Discussion:https://postgr.es/m/CAMkU=1ykK+VhhcQ4Ky8KBo9FoaUJH3f3rDQB8TkTXi-ZsBRUkQ@mail.gmail.com
1 parent5262f7a commit01e0cbc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/parser/gram.y

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12764,7 +12764,10 @@ c_expr:columnref{ $$ = $1; }
1276412764
* AEXPR_PAREN nodes wrapping all explicitly
1276512765
* parenthesized subexpressions; this prevents bogus
1276612766
* warnings from being issued when the ordering has
12767-
* been forced by parentheses.
12767+
* been forced by parentheses. Take care that an
12768+
* AEXPR_PAREN node has the same exprLocation as its
12769+
* child, so as not to cause surprising changes in
12770+
* error cursor positioning.
1276812771
*
1276912772
* In principle we should not be relying on a GUC to
1277012773
* decide whether to insert AEXPR_PAREN nodes.
@@ -12773,7 +12776,8 @@ c_expr:columnref{ $$ = $1; }
1277312776
* we'd just as soon not waste cycles on dummy parse
1277412777
* nodes if we don't have to.
1277512778
*/
12776-
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL,$2,NULL,@1);
12779+
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL,$2,NULL,
12780+
exprLocation($2));
1277712781
}
1277812782
else
1277912783
$$ =$2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp