我有这个功能:
CREATE OR REPLACE FUNCTION laborable_day(dtDateTime TIMESTAMP WITH TIME ZONE)
RETURNS TIMESTAMP WITH TIME ZONE AS $$
DECLARE
_isHoliday BOOLEAN;
BEGIN
LOOP
SELECT COUNT(*) > 0 INTO _isHoliday
FROM holidays
WHERE holiday = DATE(dtDateTime);
IF _isHoliday THEN
dtDateTime := dtDateTime + INTERVAL '1 DAY';
ELSE
EXIT;
END IF;
END LOOP;
RETURN dtDateTime;
END;
$$ LANGUAGE plpgsql STRICT SECURITY DEFINER;
如果我运行这个命令:
select laborable_day('2022-01-01 18:53:11.14297-05'::TIMESTAMPTZ);
我得到:
+------------------------------+
| laborable_day |
|------------------------------|
| 2022-01-02 23:53:11.14297+00 |
+------------------------------+
SELECT 1
Time: 0.012s
为什么时区信息会丢失?