summaryrefslogtreecommitdiff
path: root/src/backend/parser/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/parser.c')
-rw-r--r--src/backend/parser/parser.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 0e6ef778d0..919d673031 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -97,8 +97,35 @@ filtered_base_yylex(void)
/* Do we need to look ahead for a possible multiword token? */
switch (cur_token)
{
- case WITH:
+ case NULLS_P:
+ /*
+ * NULLS FIRST and NULLS LAST must be reduced to one token
+ */
+ cur_yylval = base_yylval;
+ cur_yylloc = base_yylloc;
+ next_token = base_yylex();
+ switch (next_token)
+ {
+ case FIRST_P:
+ cur_token = NULLS_FIRST;
+ break;
+ case LAST_P:
+ cur_token = NULLS_LAST;
+ break;
+ default:
+ /* save the lookahead token for next time */
+ lookahead_token = next_token;
+ lookahead_yylval = base_yylval;
+ lookahead_yylloc = base_yylloc;
+ have_lookahead = true;
+ /* and back up the output info to cur_token */
+ base_yylval = cur_yylval;
+ base_yylloc = cur_yylloc;
+ break;
+ }
+ break;
+ case WITH:
/*
* WITH CASCADED, LOCAL, or CHECK must be reduced to one token
*