I found my way to this by guesswork and good luck. (I happen to be using PG Version 13.5. But I don't suppose that this matters.)
Doing "\df tsrange()" gives this:
Schema | Name | Result data type | Argument data types | Type
------------+---------+------------------+----------------------------------------------------------------+------
pg_catalog | tsrange | tsrange | timestamp without time zone, timestamp without time zone | func
pg_catalog | tsrange | tsrange | timestamp without time zone, timestamp without time zone, text | func
And doing this:
\x on
with c as (
select
'2000-01-15'::timestamp as t1,
'2000-05-15'::timestamp as t2)
select
tsrange(t1, t2, '[]') as r1,
tsrange(t1, t2, '[)') as r2,
tsrange(t1, t2, '(]') as r3,
tsrange(t1, t2, '()') as r4
from c;
\x off
gives this:
r1 | ["2000-01-15 00:00:00","2000-05-15 00:00:00"]
r2 | ["2000-01-15 00:00:00","2000-05-15 00:00:00")
r3 | ("2000-01-15 00:00:00","2000-05-15 00:00:00"]
r4 | ("2000-01-15 00:00:00","2000-05-15 00:00:00")
It's exactly what I was looking for. Now I want to refer colleagues to the PG doc on the tsrange() function.
But I can't formulate a search that finds it using the doc site's intrinsic search.
And I can't even find a single example of it on any site using Google.
Where is it?