set timezone='UTC'; \set ON_ERROR_STOP 0 select (-9223372036854775808)::bigint::timestamp9; select 9223372036854775807::bigint::timestamp9; select (-1)::bigint::timestamp9; select 0::bigint::timestamp9; select '1677-09-21 00:12:43.145224192 +0000'::timestamp9, '1677-09-21 00:12:43.145224192 +0000'::timestamp9::bigint; select '1900-01-01 00:00:00.000000001 +0000'::timestamp9, '1900-01-01 00:00:00.000000001 +0000'::timestamp9::bigint; select '2262-04-11 23:47:16.854775807 +0000'::timestamp9, '2262-04-11 23:47:16.854775807 +0000'::timestamp9::bigint; select '1677-09-21 00:12:43.145224191 +0000'::timestamp9, '1677-09-21 00:12:43.145224191 +0000'::timestamp9::bigint; select '2262-04-11 23:47:16.854775808 +0000'::timestamp9, '2262-04-11 23:47:16.854775808 +0000'::timestamp9::bigint; select '1500-01-01 00:00:00 +0000'::timestamp9; select '3000-01-01 00:00:00 +0000'::timestamp9; select '1900-01-01 00:00:00.000000001 +0000'::timestamp9::timestamptz, '1900-01-01 00:00:00.000000001 +0000'::timestamp9::timestamptz::timestamp9; select (-1)::bigint::timestamp9::timestamptz::timestamp9::bigint; select 9223372036854775807::bigint::timestamp9::timestamptz; select (-9223372036854775808)::bigint::timestamp9::timestamptz; select '1500-01-01'::timestamptz::timestamp9; select '3000-01-01'::timestamptz::timestamp9; select '1900-01-01 00:00:00.000000001 +0000'::timestamp9::date, (-1)::bigint::timestamp9::date; select '1500-01-01'::date::timestamp9; select '2262-04-11'::date::timestamp9; select 9223372036854775807::bigint::timestamp9 + interval '1 microsecond'; select 9223372036854775807::bigint::timestamp9 + interval '1 day'; select (-9223372036854775808)::bigint::timestamp9 - interval '1 day'; select p.proname from pg_proc p join pg_depend d on d.objid=p.oid join pg_extension e on e.oid=d.refobjid where e.extname='timestamp9' and (p.proname ilike '%now%' or p.proname ilike '%clock%' or p.proname ilike '%current%'); select count(*) from pg_proc p join pg_depend d on d.objid=p.oid join pg_extension e on e.oid=d.refobjid where e.extname='timestamp9'; select '2020-01-01'::timestamp9 - '2019-01-01'::timestamp9; create table s(t timestamp9); insert into s select x::bigint::timestamp9 from unnest(array[5,-5,0,-9223372036854775808,9223372036854775807,-1000000000000000000]) x; create index on s(t); set enable_seqscan=off; select t, t::bigint from s order by t; select t::bigint from s where t < 0::bigint::timestamp9 order by t;