🐛 | Opigno statistics | Undefined function: 7 ERROR: function unix_timestamp(character varying) does not exist
🇨🇺Cuba rafageist
Create the function for PostgreSQL:
CREATE OR REPLACE FUNCTION unix_timestamp(input_text character varying)
RETURNS bigint AS $$
DECLARE
result bigint;
BEGIN
SELECT EXTRACT(epoch FROM TO_TIMESTAMP(input_text, 'YYYY-MM-DD HH24:MI:SS')) INTO result;
RETURN result;
EXCEPTION
WHEN others THEN
RAISE EXCEPTION 'Error';
END;
$$ LANGUAGE plpgsql;