By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
-- timestamp with tz
select '2022-05-10 10:44:19+08'::TIMESTAMP WITH TIME ZONE as ts;
ts |
---|
2022-05-10 03:44:19+01 |
SELECT 1
-- cast to timestamp without tz
select '2022-05-10 10:44:19+08'::TIMESTAMP WITHOUT TIME ZONE as ts;
ts |
---|
2022-05-10 10:44:19 |
SELECT 1
-- convert to char
select to_char('2022-05-10 10:44:19+08'::TIMESTAMP WITH TIME ZONE, 'YYYY-MM-DD HH24:MI:SS') as ts;
ts |
---|
2022-05-10 03:44:19 |
SELECT 1
-- specify timezone (possible to change 'UTC+x' hours)
select ('2022-05-10 10:44:19+08' at TIME ZONE 'UTC')::timestamp without time zone
timezone |
---|
2022-05-10 02:44:19 |
SELECT 1