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
eda51264
Commit
eda51264
authored
23 years ago
by
Thomas G. Lockhart
Browse files
Options
Downloads
Patches
Plain Diff
Allow variable (unrestricted) precision for TIME and TIMESTAMP types in parser.
parent
cd8b3549
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/parser/gram.y
+34
-12
34 additions, 12 deletions
src/backend/parser/gram.y
with
34 additions
and
12 deletions
src/backend/parser/gram.y
+
34
−
12
View file @
eda51264
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27
5
2001/1
1/16
04:
08
:3
3
t
gl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27
6
2001/1
2/09
04:
39
:3
9
t
homas
Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -888,16 +888,26 @@ zone_value: Sconst
...
@@ -888,16 +888,26 @@ zone_value: Sconst
{
{
A_Const *n = (A_Const *) makeStringConst($2, $1);
A_Const *n = (A_Const *) makeStringConst($2, $1);
if ($3 != -1)
if ($3 != -1)
n->typename->typmod = (($3 << 16) | 0xFFFF);
{
if (($3 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
elog(ERROR, "Time zone interval must be HOUR or HOUR TO MINUTE");
n->typename->typmod = ((($3 & 0x7FFF) << 16) | 0xFFFF);
}
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| ConstInterval '(' Iconst ')' Sconst opt_interval
| ConstInterval '(' Iconst ')' Sconst opt_interval
{
{
A_Const *n = (A_Const *) makeStringConst($5, $1);
A_Const *n = (A_Const *) makeStringConst($5, $1);
if ($6 != -1)
if ($6 != -1)
n->typename->typmod = (($6 << 16) | $3);
{
if (($6 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
elog(ERROR, "Time zone interval must be HOUR or HOUR TO MINUTE");
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
}
else
else
{
n->typename->typmod = ((0x7FFF << 16) | $3);
n->typename->typmod = ((0x7FFF << 16) | $3);
}
$$ = (Node *)n;
$$ = (Node *)n;
}
}
...
@@ -4328,10 +4338,14 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
...
@@ -4328,10 +4338,14 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
* - thomas 2001-09-06
* - thomas 2001-09-06
*/
*/
$$->timezone = $2;
$$->timezone = $2;
/* SQL99 specified a default precision of six.
/* SQL99 specified a default precision of six
* - thomas 2001-09-30
* for schema definitions. But for timestamp
* literals we don't want to throw away precision
* so leave this as unspecified for now.
* Later, we may want a different production
* for schemas. - thomas 2001-12-07
*/
*/
$$->typmod =
6
;
$$->typmod =
-1
;
}
}
| TIME '(' Iconst ')' opt_timezone
| TIME '(' Iconst ')' opt_timezone
{
{
...
@@ -4353,9 +4367,10 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
...
@@ -4353,9 +4367,10 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
else
else
$$->name = xlateSqlType("time");
$$->name = xlateSqlType("time");
/* SQL99 specified a default precision of zero.
/* SQL99 specified a default precision of zero.
* - thomas 2001-09-30
* See comments for timestamp above on why we will
* leave this unspecified for now. - thomas 2001-12-07
*/
*/
$$->typmod =
0
;
$$->typmod =
-1
;
}
}
;
;
...
@@ -5009,7 +5024,12 @@ c_expr: attr
...
@@ -5009,7 +5024,12 @@ c_expr: attr
d->name = xlateSqlType("timetz");
d->name = xlateSqlType("timetz");
d->setof = FALSE;
d->setof = FALSE;
d->typmod = 0;
/* SQL99 mandates a default precision of zero for TIME
* fields in schemas. However, for CURRENT_TIME
* let's preserve the microsecond precision we
* might see from the system clock. - thomas 2001-12-07
*/
d->typmod = 6;
$$ = (Node *)makeTypeCast((Node *)s, d);
$$ = (Node *)makeTypeCast((Node *)s, d);
}
}
...
@@ -5058,11 +5078,13 @@ c_expr: attr
...
@@ -5058,11 +5078,13 @@ c_expr: attr
t->setof = FALSE;
t->setof = FALSE;
t->typmod = -1;
t->typmod = -1;
/* SQL99 mandates a default precision of 6
* for timestamp. - thomas 2001-10-04
*/
d->name = xlateSqlType("timestamptz");
d->name = xlateSqlType("timestamptz");
d->setof = FALSE;
d->setof = FALSE;
/* SQL99 mandates a default precision of 6 for timestamp.
* Also, that is about as precise as we will get since
* we are using a microsecond time interface.
* - thomas 2001-12-07
*/
d->typmod = 6;
d->typmod = 6;
$$ = (Node *)makeTypeCast((Node *)s, d);
$$ = (Node *)makeTypeCast((Node *)s, d);
...
...
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