1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Fix parsing for <identifier>-<number> which was mis-identified as a unary

minus. Example is SELECT f1-2 FROM INT4_TBL;
This commit is contained in:
Thomas G. Lockhart
1998-02-18 07:23:22 +00:00
parent 6c1abf0d3c
commit 5ac4dcaa19
2 changed files with 220 additions and 170 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.35 1998/02/11 03:56:07 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.36 1998/02/18 07:22:40 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -311,6 +311,25 @@ other .
return (PARAM);
}
{identifier}/{space}*-{number} {
int i;
ScanKeyword *keyword;
BEGIN(xm);
for(i = 0; yytext[i]; i++)
if (isupper(yytext[i]))
yytext[i] = tolower(yytext[i]);
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
return (keyword->value);
}
else
{
yylval.str = pstrdup((char*)yytext);
return (IDENT);
}
}
{integer}/{space}*-{number} {
char* endptr;