Update lower/upper bound of range type
postgresql
Solution
I found function I missed, it's possible to do that like this
UPDATE table
SET
my_column = tstzrange(
lower(my_column),
now(),
concat(
CASE WHEN lower_inc(my_column) THEN '[' ELSE '(' END,
CASE WHEN upper_inc(my_column) THEN ']' ELSE ')' END
)
)
It would be better to create function for this probably. Or is there any other (simpler/better) solution?
Problem
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 boundaries) I managed to change ``` (-infinity,infinity) ``` with ``` UPDATE table SET my_column = tstzrange( lower(my_column), now(), '()' ) ``` and I have ``` (-infinity, <current timestamp>) ``` but I don't know how to keep boundaries from default range.. this would change even `[` `]` to `(` `)`