mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Fix YA unwanted behavioral difference with operator_precedence_warning.
Jeff Janes noted that the error cursor position shown for some errors would vary when operator_precedence_warning is turned on. We'd prefer that option to have no undocumented effects, so this isn't desirable. To fix, make sure that an AEXPR_PAREN node has the same exprLocation as its child node. (Note: it would be a little cheaper to use @2 here instead of an exprLocation call, but there are cases where that wouldn't produce the 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
This commit is contained in:
parent
3e51859ebc
commit
8350aae4f1
@ -12096,7 +12096,10 @@ c_expr: columnref { $$ = $1; }
|
|||||||
* AEXPR_PAREN nodes wrapping all explicitly
|
* AEXPR_PAREN nodes wrapping all explicitly
|
||||||
* parenthesized subexpressions; this prevents bogus
|
* parenthesized subexpressions; this prevents bogus
|
||||||
* warnings from being issued when the ordering has
|
* warnings from being issued when the ordering has
|
||||||
* been forced by parentheses.
|
* been forced by parentheses. Take care that an
|
||||||
|
* AEXPR_PAREN node has the same exprLocation as its
|
||||||
|
* child, so as not to cause surprising changes in
|
||||||
|
* error cursor positioning.
|
||||||
*
|
*
|
||||||
* In principle we should not be relying on a GUC to
|
* In principle we should not be relying on a GUC to
|
||||||
* decide whether to insert AEXPR_PAREN nodes.
|
* decide whether to insert AEXPR_PAREN nodes.
|
||||||
@ -12105,7 +12108,8 @@ c_expr: columnref { $$ = $1; }
|
|||||||
* we'd just as soon not waste cycles on dummy parse
|
* we'd just as soon not waste cycles on dummy parse
|
||||||
* nodes if we don't have to.
|
* nodes if we don't have to.
|
||||||
*/
|
*/
|
||||||
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL, $2, NULL, @1);
|
$$ = (Node *) makeA_Expr(AEXPR_PAREN, NIL, $2, NULL,
|
||||||
|
exprLocation($2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user