Re: ERROR: operator does not exist: timestamp without time zone +integer - Mailing list pgsql-general

From Adrian Klaver
Subject Re: ERROR: operator does not exist: timestamp without time zone +integer
Date
Msg-id db5a7bad-88a8-4720-37ec-23e014a3532d@aklaver.com
Whole thread Raw
In response to Re: ERROR: operator does not exist: timestamp without time zone + integer  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-general
On 4/30/19 12:11 PM, Andrew Gierth wrote:
>>>>>> "Adrian" == Adrian Klaver <adrian.klaver@aklaver.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.
> 

I would agree. Put it down to a case of tunnel vision.


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: ERROR: operator does not exist: timestamp without time zone + integer
Next
From: Chanon Sajjamanochai
Date:
Subject: PostgreSQL Asian language support for full text search using ICU (andalso updating pg_trgm)