Re: Range Types - typo + NULL string constructor

From: Thom Brown <thom(at)linux(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types - typo + NULL string constructor
Date: 2011-10-11 07:25:47
Message-ID: CAA-aLv6uwBh0unkE10U=oG6ZHCvR087AxWMM12dFPV8ud-z_Jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11 October 2011 02:14, Florian Pflug <fgp(at)phlo(dot)org> wrote:
> On Oct10, 2011, at 20:06 , Thom Brown wrote:
>> Okay, a real example of why discrete should be '[]' and continuous
>> should be '[)'.
>>
>> If you book a meeting from 09:00 to 11:00 (tsrange), at 11:00
>> precisely it either becomes free or is available to someone else, so
>> it can be booked 11:00 to 12:00 without conflict.
>>
>> If you have raffle tickets numbered 1 to 100 (int4range), and you ask
>> for tickets 9 to 11, no-one else can use 11 as it aligns with the last
>> one you bought.
>>
>> So for me, it's intuitive for them to behave differently.  So yes,
>> default behaviour would vary between types, but I didn't previously
>> read anything on default_flags, so I don't know where that comes into
>> it.  Shouldn't it be the case that if a type has a canonical function,
>> it's entirely inclusive, otherwise it's upper boundary is exclusive?
>
> First, there's the type "date", which in my book is discrete. So we'd make
> date ranges closed by default, not half-open. And there's timestamp, which
> is continuous so we'd make its default half-open. That doesn't seem exactly
> intuitive to me.

Ah yes, I agree there. Okay, I see your point.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2011-10-11 07:55:00 Re: [v9.2] make_greater_string() does not return a string in some cases
Previous Message Magnus Hagander 2011-10-11 07:21:07 Re: Bug in walsender when calling out to do_pg_stop_backup (and others?)