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
eda51264
Commit
eda51264
authored
Dec 09, 2001
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow variable (unrestricted) precision for TIME and TIMESTAMP types in parser.
parent
cd8b3549
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
src/backend/parser/gram.y
src/backend/parser/gram.y
+34
-12
No files found.
src/backend/parser/gram.y
View file @
eda51264
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27
5 2001/11/16 04:08:33 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27
6 2001/12/09 04:39:39 thomas
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -888,16 +888,26 @@ zone_value: Sconst
{
A_Const *n = (A_Const *) makeStringConst($2, $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;
}
| ConstInterval '(' Iconst ')' Sconst opt_interval
{
A_Const *n = (A_Const *) makeStringConst($5, $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
{
n->typename->typmod = ((0x7FFF << 16) | $3);
}
$$ = (Node *)n;
}
...
...
@@ -4328,10 +4338,14 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
* - thomas 2001-09-06
*/
$$->timezone = $2;
/* SQL99 specified a default precision of six.
* - thomas 2001-09-30
/* SQL99 specified a default precision of six
* 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
{
...
...
@@ -4353,9 +4367,10 @@ ConstDatetime: TIMESTAMP '(' Iconst ')' opt_timezone_x
else
$$->name = xlateSqlType("time");
/* 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
d->name = xlateSqlType("timetz");
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);
}
...
...
@@ -5058,11 +5078,13 @@ c_expr: attr
t->setof = FALSE;
t->typmod = -1;
/* SQL99 mandates a default precision of 6
* for timestamp. - thomas 2001-10-04
*/
d->name = xlateSqlType("timestamptz");
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;
$$ = (Node *)makeTypeCast((Node *)s, d);
...
...
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