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

Commit12b7164

Browse files
committed
Remove precedence labeling of keywords TRUE, FALSE, UNKNOWN, and ZONE.
These were labeled with precedences just to avoid attaching explicitprecedences to the productions in which they were the last terminal symbol.Since a terminal symbol precedence marking can affect many other thingstoo, it seems like better practice to attach precedence labels to theproductions, and not mark the terminal symbols.Ideally we'd also remove the precedence attached to NULL_P, but it turnsout that we are actually depending on that having a precedence higher thanPOSTFIXOP, else we get a shift/reduce conflict for postfix operators inb_expr. (Which more or less proves my point about these markings having ahigh risk of unexpected consequences.) For the moment, move NULL_P intothe set of keywords grouped with IDENT, so that at least it will actsimilarly to non-keywords; and document the interaction.
1 parent27525b1 commit12b7164

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

‎src/backend/parser/gram.y

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ static void SplitColQualList(List *qualList,
597597
* have any bad effects since obviously the keywords will still behave the
598598
* same as if they weren't keywords). We need to do this for PARTITION,
599599
* RANGE, ROWS to support opt_existing_window_name; and for RANGE, ROWS
600-
* so that they can follow a_expr without creating
600+
* so that they can follow a_expr without creating postfix-operator problems;
601+
* and for NULL so that it can follow b_expr in ColQualList without creating
601602
* postfix-operator problems.
602603
*
603604
* The frame_bound productions UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING
@@ -610,16 +611,16 @@ static void SplitColQualList(List *qualList,
610611
* blame any funny behavior of UNBOUNDED on the SQL standard, though.
611612
*/
612613
%nonassocUNBOUNDED/* ideally should have same precedence as IDENT*/
613-
%nonassocIDENTPARTITIONRANGEROWSPRECEDINGFOLLOWING
614+
%nonassocIDENTNULL_PPARTITIONRANGEROWSPRECEDINGFOLLOWING
614615
%leftOpOPERATOR/* multi-character ops and user-defined operators*/
615616
%nonassocNOTNULL
616617
%nonassocISNULL
617-
%nonassocISNULL_PTRUE_PFALSE_PUNKNOWN/* sets precedence for IS NULL, etc*/
618+
%nonassocIS/* sets precedence for IS NULL, etc*/
618619
%left'+''-'
619620
%left'*''/''%'
620621
%left'^'
621622
/* Unary Operators*/
622-
%leftATZONE/* sets precedence for AT TIME ZONE*/
623+
%leftAT/* sets precedence for AT TIME ZONE*/
623624
%leftCOLLATE
624625
%rightUMINUS
625626
%left'['']'
@@ -9705,7 +9706,7 @@ a_expr:c_expr{ $$ = $1; }
97059706
n->location =@2;
97069707
$$ = (Node *) n;
97079708
}
9708-
|a_exprATTIMEZONEa_expr
9709+
|a_exprATTIMEZONEa_expr%precAT
97099710
{
97109711
FuncCall *n = makeNode(FuncCall);
97119712
n->funcname = SystemFuncName("timezone");
@@ -9887,7 +9888,7 @@ a_expr:c_expr{ $$ = $1; }
98879888
*a ISNULL
98889889
*a NOTNULL
98899890
*/
9890-
|a_exprISNULL_P
9891+
|a_exprISNULL_P%precIS
98919892
{
98929893
NullTest *n = makeNode(NullTest);
98939894
n->arg = (Expr *)$1;
@@ -9901,7 +9902,7 @@ a_expr:c_expr{ $$ = $1; }
99019902
n->nulltesttype = IS_NULL;
99029903
$$ = (Node *)n;
99039904
}
9904-
|a_exprISNOTNULL_P
9905+
|a_exprISNOTNULL_P%precIS
99059906
{
99069907
NullTest *n = makeNode(NullTest);
99079908
n->arg = (Expr *)$1;
@@ -9919,42 +9920,42 @@ a_expr:c_expr{ $$ = $1; }
99199920
{
99209921
$$ = (Node *)makeOverlaps($1,$3,@2, yyscanner);
99219922
}
9922-
|a_exprISTRUE_P
9923+
|a_exprISTRUE_P%precIS
99239924
{
99249925
BooleanTest *b = makeNode(BooleanTest);
99259926
b->arg = (Expr *)$1;
99269927
b->booltesttype = IS_TRUE;
99279928
$$ = (Node *)b;
99289929
}
9929-
|a_exprISNOTTRUE_P
9930+
|a_exprISNOTTRUE_P%precIS
99309931
{
99319932
BooleanTest *b = makeNode(BooleanTest);
99329933
b->arg = (Expr *)$1;
99339934
b->booltesttype = IS_NOT_TRUE;
99349935
$$ = (Node *)b;
99359936
}
9936-
|a_exprISFALSE_P
9937+
|a_exprISFALSE_P%precIS
99379938
{
99389939
BooleanTest *b = makeNode(BooleanTest);
99399940
b->arg = (Expr *)$1;
99409941
b->booltesttype = IS_FALSE;
99419942
$$ = (Node *)b;
99429943
}
9943-
|a_exprISNOTFALSE_P
9944+
|a_exprISNOTFALSE_P%precIS
99449945
{
99459946
BooleanTest *b = makeNode(BooleanTest);
99469947
b->arg = (Expr *)$1;
99479948
b->booltesttype = IS_NOT_FALSE;
99489949
$$ = (Node *)b;
99499950
}
9950-
|a_exprISUNKNOWN
9951+
|a_exprISUNKNOWN%precIS
99519952
{
99529953
BooleanTest *b = makeNode(BooleanTest);
99539954
b->arg = (Expr *)$1;
99549955
b->booltesttype = IS_UNKNOWN;
99559956
$$ = (Node *)b;
99569957
}
9957-
|a_exprISNOTUNKNOWN
9958+
|a_exprISNOTUNKNOWN%precIS
99589959
{
99599960
BooleanTest *b = makeNode(BooleanTest);
99609961
b->arg = (Expr *)$1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp