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

Commitf69ff0c

Browse files
committed
Give 'a_expr ::= a_expr Op' production a slightly lower precedence than
Op, so that the sequence 'a_expr Op Op a_expr' will be parsed asa_expr Op (Op a_expr) not (a_expr Op) Op a_expr as formerly. In otherwords, prefer treating user-defined operators as prefix operators totreating them as postfix operators, when there is an ambiguity.Also clean up a couple of other infelicities in production priorityassignment --- for example, BETWEEN wasn't being given the intendedpriority, but that of AND.
1 parentedfca4b commitf69ff0c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/parser/gram.y

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.217 2001/01/20 17:37:52 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.218 2001/01/23 22:39:08 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -383,16 +383,16 @@ static void doNegateFloat(Value *v);
383383
%nonassocOVERLAPS
384384
%nonassocBETWEEN
385385
%nonassocIN
386+
%leftPOSTFIXOP/* dummy for postfix Op rules*/
386387
%leftOp/* multi-character ops and user-defined operators*/
387388
%nonassocNOTNULL
388389
%nonassocISNULL
389-
%nonassocNULL_P
390-
%nonassocIS
390+
%nonassocISNULL_PTRUE_PFALSE_P/* sets precedence for IS NULL, etc*/
391391
%left'+''-'
392392
%left'*''/''%'
393393
%left'^'
394394
/* Unary Operators*/
395-
%leftAT
395+
%leftATZONE/* sets precedence for AT TIME ZONE*/
396396
%rightUMINUS
397397
%left'.'
398398
%left'['']'
@@ -4355,7 +4355,7 @@ a_expr: c_expr
43554355
{$$ = makeA_Expr(OP,$2,$1,$3); }
43564356
|Opa_expr
43574357
{$$ = makeA_Expr(OP,$1,NULL,$2); }
4358-
|a_exprOp
4358+
|a_exprOp%precPOSTFIXOP
43594359
{$$ = makeA_Expr(OP,$2,$1,NULL); }
43604360

43614361
|a_exprANDa_expr
@@ -4463,13 +4463,13 @@ a_expr: c_expr
44634463
n->typename->typmod = -1;
44644464
$$ = makeA_Expr(OP,"=",$1,(Node *)n);
44654465
}
4466-
|a_exprBETWEENb_exprANDb_expr
4466+
|a_exprBETWEENb_exprANDb_expr%precBETWEEN
44674467
{
44684468
$$ = makeA_Expr(AND,NULL,
44694469
makeA_Expr(OP,">=", $1, $3),
44704470
makeA_Expr(OP,"<=", $1, $5));
44714471
}
4472-
|a_exprNOTBETWEENb_exprANDb_expr
4472+
|a_exprNOTBETWEENb_exprANDb_expr%precBETWEEN
44734473
{
44744474
$$ = makeA_Expr(OR,NULL,
44754475
makeA_Expr(OP,"<", $1, $4),
@@ -4529,7 +4529,7 @@ a_expr: c_expr
45294529
$$ = n;
45304530
}
45314531
}
4532-
|a_exprall_Opsub_typeselect_with_parens
4532+
|a_exprall_Opsub_typeselect_with_parens%precOp
45334533
{
45344534
SubLink *n = makeNode(SubLink);
45354535
n->lefthand = makeList1($1);
@@ -4591,7 +4591,7 @@ b_expr: c_expr
45914591
{$$ = makeA_Expr(OP,$2,$1,$3); }
45924592
|Opb_expr
45934593
{$$ = makeA_Expr(OP,$1,NULL,$2); }
4594-
|b_exprOp
4594+
|b_exprOp%precPOSTFIXOP
45954595
{$$ = makeA_Expr(OP,$2,$1,NULL); }
45964596
;
45974597

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp