Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5e9e8849
Commit
5e9e8849
authored
Feb 11, 1998
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically promote out of range integers to floats.
Throw elog(NOTICE) to flag promotion.
parent
9e22f825
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
18 deletions
+50
-18
src/backend/parser/scan.c
src/backend/parser/scan.c
+30
-14
src/backend/parser/scan.l
src/backend/parser/scan.l
+20
-4
No files found.
src/backend/parser/scan.c
View file @
5e9e8849
/* A lexical scanner generated by flex */
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
/* Scanner skeleton version:
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.1
1 1998/02/02 00:03:39 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.1
2 1998/02/11 03:56:08 thomas
Exp $
*/
*/
#define FLEX_SCANNER
#define FLEX_SCANNER
...
@@ -539,7 +539,7 @@ char *yytext;
...
@@ -539,7 +539,7 @@ char *yytext;
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.1
1 1998/02/02 00:03:39 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.1
2 1998/02/11 03:56:08 thomas
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1159,13 +1159,21 @@ YY_RULE_SETUP
...
@@ -1159,13 +1159,21 @@ YY_RULE_SETUP
errno
=
0
;
errno
=
0
;
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
ERROR
,
"Bad integer input '%s'"
,
yytext
);
{
errno
=
0
;
yylval
.
dval
=
strtod
(((
char
*
)
yytext
),
&
endptr
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
ERROR
,
"Bad integer input '%s'"
,
yytext
);
CheckFloat8Val
(
yylval
.
dval
);
elog
(
NOTICE
,
"Integer input '%s' is out of range; promoted to float"
,
yytext
);
return
(
FCONST
);
}
return
(
ICONST
);
return
(
ICONST
);
}
}
YY_BREAK
YY_BREAK
case
34
:
case
34
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
24
"scan.l"
#line 3
32
"scan.l"
{
{
char
*
endptr
;
char
*
endptr
;
...
@@ -1173,27 +1181,35 @@ YY_RULE_SETUP
...
@@ -1173,27 +1181,35 @@ YY_RULE_SETUP
errno
=
0
;
errno
=
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 float8 input '%s'"
,
yytext
);
elog
(
ERROR
,
"Bad float8 input '%s'"
,
yytext
);
CheckFloat8Val
(
yylval
.
dval
);
CheckFloat8Val
(
yylval
.
dval
);
return
(
FCONST
);
return
(
FCONST
);
}
}
YY_BREAK
YY_BREAK
case
35
:
case
35
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
35
"scan.l"
#line 3
43
"scan.l"
{
{
char
*
endptr
;
char
*
endptr
;
errno
=
0
;
errno
=
0
;
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
ERROR
,
"Bad integer input '%s'"
,
yytext
);
{
errno
=
0
;
yylval
.
dval
=
strtod
(((
char
*
)
yytext
),
&
endptr
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
ERROR
,
"Bad integer input '%s'"
,
yytext
);
CheckFloat8Val
(
yylval
.
dval
);
elog
(
NOTICE
,
"Integer input '%s' is out of range; promoted to float"
,
yytext
);
return
(
FCONST
);
}
return
(
ICONST
);
return
(
ICONST
);
}
}
YY_BREAK
YY_BREAK
case
36
:
case
36
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
44
"scan.l"
#line 3
60
"scan.l"
{
{
char
*
endptr
;
char
*
endptr
;
...
@@ -1207,7 +1223,7 @@ YY_RULE_SETUP
...
@@ -1207,7 +1223,7 @@ YY_RULE_SETUP
YY_BREAK
YY_BREAK
case
37
:
case
37
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
54
"scan.l"
#line 3
70
"scan.l"
{
{
int
i
;
int
i
;
ScanKeyword
*
keyword
;
ScanKeyword
*
keyword
;
...
@@ -1229,20 +1245,20 @@ YY_RULE_SETUP
...
@@ -1229,20 +1245,20 @@ YY_RULE_SETUP
YY_BREAK
YY_BREAK
case
38
:
case
38
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
72
"scan.l"
#line 3
88
"scan.l"
{
/* ignore */
}
{
/* ignore */
}
YY_BREAK
YY_BREAK
case
39
:
case
39
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
74
"scan.l"
#line 3
90
"scan.l"
{
return
(
yytext
[
0
]);
}
{
return
(
yytext
[
0
]);
}
YY_BREAK
YY_BREAK
case
40
:
case
40
:
YY_RULE_SETUP
YY_RULE_SETUP
#line 3
76
"scan.l"
#line 3
92
"scan.l"
ECHO
;
ECHO
;
YY_BREAK
YY_BREAK
#line 12
46
"lex.yy.c"
#line 12
62
"lex.yy.c"
case
YY_STATE_EOF
(
INITIAL
):
case
YY_STATE_EOF
(
INITIAL
):
case
YY_STATE_EOF
(
xb
):
case
YY_STATE_EOF
(
xb
):
case
YY_STATE_EOF
(
xc
):
case
YY_STATE_EOF
(
xc
):
...
@@ -2128,7 +2144,7 @@ int main()
...
@@ -2128,7 +2144,7 @@ int main()
return
0
;
return
0
;
}
}
#endif
#endif
#line 3
76
"scan.l"
#line 3
92
"scan.l"
void
yyerror
(
char
message
[])
void
yyerror
(
char
message
[])
...
...
src/backend/parser/scan.l
View file @
5e9e8849
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.3
4 1998/01/05 16:39:19 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.3
5 1998/02/11 03:56:07 thomas
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -318,7 +318,15 @@ other .
...
@@ -318,7 +318,15 @@ other .
errno = 0;
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad integer input '%s'",yytext);
{
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
return (FCONST);
}
return (ICONST);
return (ICONST);
}
}
{real}/{space}*-{number} {
{real}/{space}*-{number} {
...
@@ -328,7 +336,7 @@ other .
...
@@ -328,7 +336,7 @@ other .
errno = 0;
errno = 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 float8 input '%s'",yytext);
elog(ERROR,"Bad float8 input '%s'",yytext);
CheckFloat8Val(yylval.dval);
CheckFloat8Val(yylval.dval);
return (FCONST);
return (FCONST);
}
}
...
@@ -338,7 +346,15 @@ other .
...
@@ -338,7 +346,15 @@ other .
errno = 0;
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad integer input '%s'",yytext);
{
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
return (FCONST);
}
return (ICONST);
return (ICONST);
}
}
{real} {
{real} {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment