How to get an inclusive interval when using daterange

From: hmidi slim <hmidi(dot)slim2(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to get an inclusive interval when using daterange
Date: 2018-04-02 18:09:56
Message-ID: CAMsqVxtEkr-KwmvoM==+8vruv0hMc9bLd8E+csrRzAxfkx36wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a table* availability* which contains 3 columns: * id, product_id
and period_availability(type daterange).*

When I insert a data into this table I use this query:
insert into availability values ('product x', daterange('2018-02-02',
'2018-03-01', '[]')

So I get a period like this: [2018-02-02, 2018-03-02)
In my app I tried to subtract a day from the period when I got it from
database.I'm using daterange and not tsrange because the daterange gives me
less execution time when I make tests with a huge number of data.So is
there any way to get an inclusive interval with daterange or I have to use
tsrange to get inclusive intervals?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2018-04-02 18:30:50 Re: [PATCH] Logical decoding of TRUNCATE
Previous Message Mr. Baseball 34 2018-04-02 17:23:54 Concatenate of values in hierarchical data