Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Alban Hertroys'" <haramrae(at)gmail(dot)com>, "'Daniele Varrazzo'" <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: "'Craig Ringer'" <ringerc(at)ringerc(dot)id(dot)au>, "'Chris Bartlett'" <c(dot)bartlett(at)paradise(dot)net(dot)nz>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)
Date: 2012-07-16 18:08:44
Message-ID: 014f01cd637e$0a4a4100$1edec300$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Alban Hertroys
> Sent: Monday, July 16, 2012 1:44 PM
> To: Daniele Varrazzo
> Cc: Craig Ringer; Chris Bartlett; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Can't figure out how to use now() in default for
> tsrange column (PG 9.2)
> That said, if it were up to me to decide what the proper epoch value would
> be for infinity, I'd say NULL - it is unknown as computers simply can't
count
> far enough. It's probably only a matter of time until someone thinks of a
> solution for that though.
>

Given:
A) extract() returns a "double precision"
B) "... In addition to ordinary numeric values, the floating-point types
have several special values: ... 'Infinity ..."

I would vote that the epoch result should be "Infinity".

Specific, but unknown (e.g., day of week, month, year, etc...) results could
return "NaN" though "NULL" is also, probably more, reasonable given the
context.

The goal would be to use "Infinity" in case where "<>" comparisons are
common and use "NULL" where "=" comparisons are common.

Personally I'd prefer to generate an error in places where "NULL" would be
the result in order to minimize bugs.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Konoplev 2012-07-16 18:35:49 Re: Replication/cloning: rsync vs modification dates?
Previous Message Alban Hertroys 2012-07-16 17:44:08 Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)