Re: Adding 1 week to a timestamp, which can be NULL or expired

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Adding 1 week to a timestamp, which can be NULL or expired
Дата
Msg-id 4EC8D8AC.1080908@hogranch.com
обсуждение исходный текст
Ответ на Adding 1 week to a timestamp, which can be NULL or expired  (Alexander Farber <alexander.farber@gmail.com>)
Список pgsql-general
On 11/20/11 2:32 AM, Alexander Farber wrote:
>     update pref_users set vip = max(vip, now()) + interval '1 week';
>
> but max() doesn't work with timestamps.

max works fine with timestamps... however, its a 1 argument function
that takes an aggregate as its argument.

you perhaps want GREATEST(val1,val2)

update pref_users set vip = greatest(vip, now()) + interval '1 week';



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


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

Предыдущее
От: Alexander Farber
Дата:
Сообщение: Adding 1 week to a timestamp, which can be NULL or expired
Следующее
От: Marko Kreen
Дата:
Сообщение: Re: Installed. Now what?