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

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Adding 1 week to a timestamp, which can be NULL or expired
Date: 2011-11-20 10:32:42
Message-ID: CAADeyWgPPb4Z2kWSgG1xxKjsCk0znxpDjZsdY1OVDjPw+8LD-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I'm trying to add 1 week "VIP-status" to all users in a table:

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

but max() doesn't work with timestamps.

Is there maybe still a way to solve it with a one-liner?

Thank you
Alex

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-11-20 10:38:36 Re: Adding 1 week to a timestamp, which can be NULL or expired
Previous Message Phoenix Kiula 2011-11-20 10:28:34 Re: Installed. Now what?