I have column of tstzrange
type (timestamp with time zone range) and I need to update only upper or lower bound of this value (and keep inclusive/exclusive boundari
Improvement to Mikes great answer.
When we use the pseudo-type anyrange, we only need a single function:
CREATE OR REPLACE FUNCTION range_bounds(IN range anyrange)
RETURNS CHAR(2) AS
$$
SELECT CASE WHEN lower_inc(range) THEN '[' ELSE '(' END ||
CASE WHEN upper_inc(range) THEN ']' ELSE ')' END;
$$
LANGUAGE SQL
RETURNS NULL ON NULL INPUT;