I have a table with a column of type tstzrange in a Postgres 10.6 database.
I need to insert / update rows with a defined lower bound but the value of the current time for the upper bound of the range, so NOW() as upper value.
Have tried things like:
UPDATE table_name
SET date_range = ['2018-03-23 00:00:00-05', now())
WHERE id = 3;
Is there a way to use a built-in function or a subquery maybe?
Use a range constructor. The manual:
So:
I assume you are aware that
now()resolves to the start time of the transaction.