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

Commit8350aae

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 parent3e51859 commit8350aae

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
@@ -12096,7 +12096,10 @@ c_expr:columnref{ $$ = $1; }
1209612096
* AEXPR_PAREN nodes wrapping all explicitly
1209712097
* parenthesized subexpressions; this prevents bogus
1209812098
* warnings from being issued when the ordering has
12099-
* been forced by parentheses.
12099+
* been forced by parentheses. Take care that an
12100+
* AEXPR_PAREN node has the same exprLocation as its
12101+
* child, so as not to cause surprising changes in
12102+
* error cursor positioning.
1210012103
*
1210112104
* In principle we should not be relying on a GUC to
1210212105
* decide whether to insert AEXPR_PAREN nodes.
@@ -12105,7 +12108,8 @@ c_expr:columnref{ $$ = $1; }
1210512108
* we'd just as soon not waste cycles on dummy parse
1210612109
* nodes if we don't have to.
1210712110
*/
12108-
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL,$2,NULL,@1);
12111+
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL,$2,NULL,
12112+
exprLocation($2));
1210912113
}
1211012114
else
1211112115
$$ =$2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp