mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
ido-pgsql: Use timestamp without time zone in from_unixtime and to_timestamp functions
refs #13221
This commit is contained in:
parent
aadfedc3d4
commit
69d3016bef
@ -10,12 +10,14 @@
|
|||||||
-- Functions
|
-- Functions
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION from_unixtime(bigint) RETURNS timestamp with time zone AS '
|
DROP FUNCTION IF EXISTS from_unixtime(bigint);
|
||||||
SELECT to_timestamp($1) AS result
|
CREATE FUNCTION from_unixtime(bigint) RETURNS timestamp AS $$
|
||||||
' LANGUAGE sql;
|
SELECT to_timestamp($1) AT TIME ZONE 'UTC' AS result
|
||||||
|
$$ LANGUAGE sql;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS '
|
DROP FUNCTION IF EXISTS unix_timestamp(timestamp WITH TIME ZONE);
|
||||||
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result;
|
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp) RETURNS bigint AS '
|
||||||
|
SELECT CAST(EXTRACT(EPOCH FROM $1) AS bigint) AS result;
|
||||||
' LANGUAGE sql;
|
' LANGUAGE sql;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user