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
7b06d995
Commit
7b06d995
authored
Dec 04, 1997
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backend code redefinitions to allow read/write
of integer Unix system times.
parent
8d30b408
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
contrib/unixdate/unixdate.sql
contrib/unixdate/unixdate.sql
+54
-0
No files found.
contrib/unixdate/unixdate.sql
0 → 100644
View file @
7b06d995
-- unixdate
-- Routines to convert int4 (Unix system time) to datetime
-- and int4 (delta time) to timespan
--
-- Thomas Lockhart (lockhart@alumni.caltech.edu)
-- 1997-11-25
--
-- This cheats and reuses existing code in the standard package.
-- Can not include this directly because built-in functions are optimized
-- into a cache and the duplicate function names abstime_datetime() and
-- reltime_timespan() result in duplicate constants.
--
-- This works with Postgres v6.2 and higher.
--
-- Conversions from integer to datetime
--
CREATE
FUNCTION
abstime_datetime
(
int4
)
RETURNS
datetime
AS
'-'
LANGUAGE
'internal'
;
CREATE
FUNCTION
datetime
(
int4
)
RETURNS
datetime
AS
'select abstime_datetime($1)'
LANGUAGE
'SQL'
;
CREATE
FUNCTION
reltime_timespan
(
int4
)
RETURNS
timespan
AS
'-'
LANGUAGE
'internal'
;
CREATE
FUNCTION
timespan
(
int4
)
RETURNS
timespan
AS
'select reltime_timespan($1)'
LANGUAGE
'SQL'
;
--
-- Conversions back to integer
--
CREATE
FUNCTION
datetime_abstime
(
datetime
)
RETURNS
int4
AS
'-'
LANGUAGE
'internal'
;
CREATE
FUNCTION
utime
(
datetime
)
RETURNS
int4
AS
'select datetime_abstime($1)'
LANGUAGE
'SQL'
;
CREATE
FUNCTION
timespan_reltime
(
timespan
)
RETURNS
int4
AS
'-'
LANGUAGE
'internal'
;
CREATE
FUNCTION
uspan
(
timespan
)
RETURNS
int4
AS
'select timespan_reltime($1)'
LANGUAGE
'SQL'
;
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