tsrange in my project, but I don't know how to represent something.
I have a product that can be displayed on my website at some times, and can be hidden at other times. But
tsrange has only 2 bounds (lower, upper). How can I represent an suite of ranges which can be indexed (by gist) and selected with the same operators of
tsrange? (like this:
tsrange but I can't index this and I can't use
tsrange operators. I found that I can create them.
For this solution, I don't want a table
product_range with two column's.
What is the best practice?
This is an example what I want :
CREATE TEMPORARY TABLE product ( id BIGSERIAL, name VARCHAR(15), selling_dates TSRANGE ); INSERT INTO product (name, selling_dates) VALUES ('Puppet', ARRAY[tsrange(NULL, '2019-01-01'), tsrange('2019-05-03', '2019-08-04')]); CREATE INDEX product_selling_dates ON product USING GIST (selling_dates); SELECT * FROM product WHERE selling_dates <@ '2019-06-10'::TIMESTAMP