Re: ERROR: operator does not exist: timestamp without time zone + integer

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: ERROR: operator does not exist: timestamp without time zone + integer
Date: 2019-04-30 19:11:59
Message-ID: 878svrux71.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Adrian" == Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:

>> yeesh. that's a very long-winded way to write current_date + 7

Adrian> Yeah, I was just working of the OP's original DEFAULT:

Adrian> site_mode_date timestamp NOT NULL DEFAULT date_trunc('day',
Adrian> LOCALTIMESTAMP)+7,

Right, but since all these are exactly equivalent:

CURRENT_DATE
LOCALTIMESTAMP::date
date_trunc('day',LOCALTIMESTAMP)::date

and since date can be cast to timestamp, then DEFAULT current_date+7
would seem to be the simplest answer.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-04-30 22:25:38 Re: ERROR: operator does not exist: timestamp without time zone + integer
Previous Message Adrian Klaver 2019-04-30 18:55:03 Re: ERROR: operator does not exist: timestamp without time zone + integer