mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Restore the ability to use | and -> as prefix operators.
Commit 2f094e7ac changed the parser to treat these as built-in
operator names, where before they were just generic Op. While
it correctly gave them the same precedence as Op and added new
productions to allow them to still be used as infix operators,
it missed allowing them to still be used as prefix operators.
At least one extension expects to be able to do that, so add
the necessary productions.
Bug: #19558
Reported-by: Pierre Senellart <pierre@senellart.com>
Author: Pierre Forstmann <pierre.forstmann@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19558-ad1fca59a3a471a0@postgresql.org
Backpatch-through: 19
This commit is contained in:
@@ -15884,6 +15884,10 @@ a_expr: c_expr { $$ = $1; }
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $3, @2); }
|
||||
| a_expr NOT_EQUALS a_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "<>", $1, $3, @2); }
|
||||
| RIGHT_ARROW a_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", NULL, $2, @1); }
|
||||
| '|' a_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "|", NULL, $2, @1); }
|
||||
| a_expr RIGHT_ARROW a_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", $1, $3, @2); }
|
||||
| a_expr '|' a_expr
|
||||
@@ -16368,6 +16372,10 @@ b_expr: c_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", $1, $3, @2); }
|
||||
| b_expr NOT_EQUALS b_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "<>", $1, $3, @2); }
|
||||
| RIGHT_ARROW b_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", NULL, $2, @1); }
|
||||
| '|' b_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "|", NULL, $2, @1); }
|
||||
| b_expr RIGHT_ARROW b_expr
|
||||
{ $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", $1, $3, @2); }
|
||||
| b_expr '|' b_expr
|
||||
|
||||
Reference in New Issue
Block a user