Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
5e9e8849
Commit
5e9e8849
authored
27 years ago
by
Thomas G. Lockhart
Browse files
Options
Downloads
Patches
Plain Diff
Automatically promote out of range integers to floats.
Throw elog(NOTICE) to flag promotion.
parent
9e22f825
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/parser/scan.c
+30
-14
30 additions, 14 deletions
src/backend/parser/scan.c
src/backend/parser/scan.l
+20
-4
20 additions, 4 deletions
src/backend/parser/scan.l
with
50 additions
and
18 deletions
src/backend/parser/scan.c
+
30
−
14
View file @
5e9e8849
/* A lexical scanner generated by flex */
/* 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
...
...
@@ -539,7 +539,7 @@ char *yytext;
*
*
* 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
errno
=
0
;
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
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
);
}
YY_BREAK
case
34
:
YY_RULE_SETUP
#line 32
4
"scan.l"
#line 3
3
2 "scan.l"
{
char
*
endptr
;
...
...
@@ -1173,27 +1181,35 @@ YY_RULE_SETUP
errno
=
0
;
yylval
.
dval
=
strtod
(((
char
*
)
yytext
),
&
endptr
);
if
(
*
endptr
!=
'\0'
||
errno
==
ERANGE
)
elog
(
ERROR
,
"Bad float8 input '%s'"
,
yytext
);
elog
(
ERROR
,
"Bad float8 input '%s'"
,
yytext
);
CheckFloat8Val
(
yylval
.
dval
);
return
(
FCONST
);
}
YY_BREAK
case
35
:
YY_RULE_SETUP
#line 33
5
"scan.l"
#line 3
4
3 "scan.l"
{
char
*
endptr
;
errno
=
0
;
yylval
.
ival
=
strtol
((
char
*
)
yytext
,
&
endptr
,
10
);
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
);
}
YY_BREAK
case
36
:
YY_RULE_SETUP
#line 3
44
"scan.l"
#line 3
60
"scan.l"
{
char
*
endptr
;
...
...
@@ -1207,7 +1223,7 @@ YY_RULE_SETUP
YY_BREAK
case
37
:
YY_RULE_SETUP
#line 3
54
"scan.l"
#line 3
70
"scan.l"
{
int
i
;
ScanKeyword
*
keyword
;
...
...
@@ -1229,20 +1245,20 @@ YY_RULE_SETUP
YY_BREAK
case
38
:
YY_RULE_SETUP
#line 3
72
"scan.l"
#line 3
88
"scan.l"
{
/* ignore */
}
YY_BREAK
case
39
:
YY_RULE_SETUP
#line 3
74
"scan.l"
#line 3
90
"scan.l"
{
return
(
yytext
[
0
]);
}
YY_BREAK
case
40
:
YY_RULE_SETUP
#line 3
76
"scan.l"
#line 3
92
"scan.l"
ECHO
;
YY_BREAK
#line 12
4
6 "lex.yy.c"
#line 126
2
"lex.yy.c"
case
YY_STATE_EOF
(
INITIAL
):
case
YY_STATE_EOF
(
xb
):
case
YY_STATE_EOF
(
xc
):
...
...
@@ -2128,7 +2144,7 @@ int main()
return
0
;
}
#endif
#line 3
76
"scan.l"
#line 3
92
"scan.l"
void
yyerror
(
char
message
[])
...
...
This diff is collapsed.
Click to expand it.
src/backend/parser/scan.l
+
20
−
4
View file @
5e9e8849
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.3
4
1998/0
1/05 16:39:19 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.3
5
1998/0
2/11 03:56:07 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -318,7 +318,15 @@ other .
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
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);
}
{real}/{space}*-{number} {
...
...
@@ -328,7 +336,7 @@ other .
errno = 0;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad float8 input '%s'",yytext);
elog(ERROR,"Bad float8 input '%s'",yytext);
CheckFloat8Val(yylval.dval);
return (FCONST);
}
...
...
@@ -338,7 +346,15 @@ other .
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,10);
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);
}
{real} {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment