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
66565885
Commit
66565885
authored
Feb 09, 2012
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve interval_transform function to detect a few more cases.
Noah Misch, per a review comment from me.
parent
d7ea9193
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/timestamp.c
+7
-2
No files found.
src/backend/utils/adt/timestamp.c
View file @
66565885
...
@@ -958,6 +958,7 @@ interval_transform(PG_FUNCTION_ARGS)
...
@@ -958,6 +958,7 @@ interval_transform(PG_FUNCTION_ARGS)
int
new_range
=
INTERVAL_RANGE
(
new_typmod
);
int
new_range
=
INTERVAL_RANGE
(
new_typmod
);
int
new_precis
=
INTERVAL_PRECISION
(
new_typmod
);
int
new_precis
=
INTERVAL_PRECISION
(
new_typmod
);
int
new_range_fls
;
int
new_range_fls
;
int
old_range_fls
;
if
(
old_typmod
==
-
1
)
if
(
old_typmod
==
-
1
)
{
{
...
@@ -974,12 +975,16 @@ interval_transform(PG_FUNCTION_ARGS)
...
@@ -974,12 +975,16 @@ interval_transform(PG_FUNCTION_ARGS)
* Temporally-smaller fields occupy higher positions in the range
* Temporally-smaller fields occupy higher positions in the range
* bitmap. Since only the temporally-smallest bit matters for length
* bitmap. Since only the temporally-smallest bit matters for length
* coercion purposes, we compare the last-set bits in the ranges.
* coercion purposes, we compare the last-set bits in the ranges.
* Precision, which is to say, sub-second precision, only affects
* ranges that include SECOND.
*/
*/
new_range_fls
=
fls
(
new_range
);
new_range_fls
=
fls
(
new_range
);
old_range_fls
=
fls
(
old_range
);
if
(
new_typmod
==
-
1
||
if
(
new_typmod
==
-
1
||
((
new_range_fls
>=
SECOND
||
((
new_range_fls
>=
SECOND
||
new_range_fls
>=
fls
(
old_range
))
&&
new_range_fls
>=
old_range_fls
)
&&
(
new_precis
>=
MAX_INTERVAL_PRECISION
||
(
old_range_fls
<
SECOND
||
new_precis
>=
MAX_INTERVAL_PRECISION
||
new_precis
>=
old_precis
)))
new_precis
>=
old_precis
)))
ret
=
relabel_to_typmod
(
source
,
new_typmod
);
ret
=
relabel_to_typmod
(
source
,
new_typmod
);
}
}
...
...
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