Re: querying the age of a row

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: querying the age of a row
Дата
Msg-id 46690F2E.9010004@magproductions.nl
обсуждение исходный текст
Ответ на Re: querying the age of a row  ("John D. Burger" <john@mitre.org>)
Список pgsql-general
John D. Burger wrote:
> In any event, you say you need to know when a row is less than 24 hours
> old - that is presumably not an issue for these old rows.  I would add
> the column as suggested, but set it to some time in the past for the
> existing rows.  Or, you can set it to NULL, appropriately if you
> interpret NULL as unknown, and test the age with something like this:
>
>   where (age(coalesce(ts, '-infinity'::timestamp)) < '24 hours'::interval

...and actually you wouldn't even need the coalesce, as

  NULL < '24 hours'::interval IS NULL

...which is considered FALSE by the WHERE clause. It's probably wiser
not to rely on that in your code though, it can be confusing ;)

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

В списке pgsql-general по дате отправления:

Предыдущее
От: Samatha Kottha
Дата:
Сообщение: Re: setting login database
Следующее
От: "Alexander Staubo"
Дата:
Сообщение: Re: cube problem