mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Keep long non-quoted numeric strings *as* untyped strings if they fail
the obvious conversion. Define a new pattern "decimal" which is non-exponential floating point for use with numeric() and decimal() types.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.48 1999/05/03 19:09:42 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.49 1999/05/12 07:12:51 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -37,6 +37,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#define YY_READ_BUF_SIZE MAX_PARSE_BUFFER
|
#define YY_READ_BUF_SIZE MAX_PARSE_BUFFER
|
||||||
|
|
||||||
|
#ifdef YY_READ_BUF_SIZE
|
||||||
|
#undef YY_READ_BUF_SIZE
|
||||||
|
#endif
|
||||||
|
#define YY_READ_BUF_SIZE MAX_PARSE_BUFFER
|
||||||
|
|
||||||
extern char *parseString;
|
extern char *parseString;
|
||||||
static char *parseCh;
|
static char *parseCh;
|
||||||
|
|
||||||
@ -157,10 +162,11 @@ operator {op_and_self}+
|
|||||||
xmstop -
|
xmstop -
|
||||||
|
|
||||||
integer [\-]?{digit}+
|
integer [\-]?{digit}+
|
||||||
|
decimal [\-]?(({digit}*\.{digit}+)|({digit}+\.{digit}*))
|
||||||
|
real [\-]?((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+))
|
||||||
/*
|
/*
|
||||||
real [\-]?{digit}+\.{digit}+([Ee][-+]?{digit}+)?
|
|
||||||
*/
|
|
||||||
real [\-]?(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
|
real [\-]?(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
|
||||||
|
*/
|
||||||
|
|
||||||
param \${integer}
|
param \${integer}
|
||||||
|
|
||||||
@ -339,15 +345,35 @@ other .
|
|||||||
if (*endptr != '\0' || errno == ERANGE)
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
#if 0
|
||||||
yylval.dval = strtod(((char *)yytext),&endptr);
|
yylval.dval = strtod(((char *)yytext),&endptr);
|
||||||
if (*endptr != '\0' || errno == ERANGE)
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
elog(ERROR,"Bad integer input '%s'",yytext);
|
elog(ERROR,"Bad integer input '%s'",yytext);
|
||||||
CheckFloat8Val(yylval.dval);
|
CheckFloat8Val(yylval.dval);
|
||||||
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
|
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
|
||||||
return FCONST;
|
return FCONST;
|
||||||
|
#endif
|
||||||
|
yylval.str = pstrdup((char*)yytext);
|
||||||
|
return SCONST;
|
||||||
}
|
}
|
||||||
return ICONST;
|
return ICONST;
|
||||||
}
|
}
|
||||||
|
{decimal}/{space}*-{number} {
|
||||||
|
char* endptr;
|
||||||
|
|
||||||
|
BEGIN(xm);
|
||||||
|
if (strlen((char *)yytext) <= 17)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
yylval.dval = strtod(((char *)yytext),&endptr);
|
||||||
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
|
elog(ERROR,"Bad float8 input '%s'",yytext);
|
||||||
|
CheckFloat8Val(yylval.dval);
|
||||||
|
return FCONST;
|
||||||
|
}
|
||||||
|
yylval.str = pstrdup((char*)yytext);
|
||||||
|
return SCONST;
|
||||||
|
}
|
||||||
{real}/{space}*-{number} {
|
{real}/{space}*-{number} {
|
||||||
char* endptr;
|
char* endptr;
|
||||||
|
|
||||||
@ -367,15 +393,34 @@ other .
|
|||||||
if (*endptr != '\0' || errno == ERANGE)
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
#if 0
|
||||||
yylval.dval = strtod(((char *)yytext),&endptr);
|
yylval.dval = strtod(((char *)yytext),&endptr);
|
||||||
if (*endptr != '\0' || errno == ERANGE)
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
elog(ERROR,"Bad integer input '%s'",yytext);
|
elog(ERROR,"Bad integer input '%s'",yytext);
|
||||||
CheckFloat8Val(yylval.dval);
|
CheckFloat8Val(yylval.dval);
|
||||||
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
|
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
|
||||||
return FCONST;
|
return FCONST;
|
||||||
|
#endif
|
||||||
|
yylval.str = pstrdup((char*)yytext);
|
||||||
|
return SCONST;
|
||||||
}
|
}
|
||||||
return ICONST;
|
return ICONST;
|
||||||
}
|
}
|
||||||
|
{decimal} {
|
||||||
|
char* endptr;
|
||||||
|
|
||||||
|
if (strlen((char *)yytext) <= 17)
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
yylval.dval = strtod((char *)yytext,&endptr);
|
||||||
|
if (*endptr != '\0' || errno == ERANGE)
|
||||||
|
elog(ERROR,"Bad float input '%s'",yytext);
|
||||||
|
CheckFloat8Val(yylval.dval);
|
||||||
|
return FCONST;
|
||||||
|
}
|
||||||
|
yylval.str = pstrdup((char*)yytext);
|
||||||
|
return SCONST;
|
||||||
|
}
|
||||||
{real} {
|
{real} {
|
||||||
char* endptr;
|
char* endptr;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user