*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.9 1997/02/14 04:15:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.10 1997/02/19 20:10:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdlib.h>
#endif /* __linux__ */
#include <string.h>
+#include <errno.h>
#include "postgres.h"
#include "miscadmin.h"
#include "parser/scansup.h"
#include "parser/sysfunc.h"
#include "parse.h"
+#include "utils/builtins.h"
extern char *parseString;
extern char *parseCh;
return (ICONST);
}
{real} {
- yylval.dval = atof((char*)yytext);
- return (FCONST);
+ char* endptr;
+ errno = 0;
+ yylval.dval = strtod(((char *)yytext),&endptr);
+ if (*endptr != '\0' || errno == ERANGE)
+ elog(WARN,"\tBad float8 input format\n");
+ CheckFloat8Val(yylval.dval);
+ return (FCONST);
}
{quote} {
char literal[MAX_PARSE_BUFFER];
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.11 1997/02/14 04:17:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.12 1997/02/19 20:10:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
raise an elog warning if it is
*/
-static void CheckFloat8Val(double val)
+void CheckFloat8Val(double val)
{
/* defining unsafe floats's will make float4 and float8 ops faster
at the cost of safety, of course! */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.8 1996/11/16 04:59:10 momjian Exp $
+ * $Id: builtins.h,v 1.9 1997/02/19 20:11:05 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
extern char *filename_out(char *s);
/* float.c */
+extern void CheckFloat8Val(double val); /* used by lex */
extern float32 float4in(char *num);
extern char *float4out(float32 num);
extern float64 float8in(char *num);