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

From Ray O'Donnell
Subject Re: ERROR: operator does not exist: timestamp without time zone +integer
Date
Msg-id df556cf3-6cb8-6e9f-6585-8c3e045bccc0@rodonnell.ie
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 30/04/2019 16:00, Andrew Gierth wrote:
>>>>>> "Adrian" == Adrian Klaver <adrian.klaver@aklaver.com> writes:
> 
>   Adrian> Or cast to a date:
> 
>   Adrian> test=> select date_trunc('day', localtimestamp)::date + 7;
> 
> yeesh. that's a very long-winded way to write current_date + 7

Well, current_date is different: current_date returns a date, so you 
only have to do:

    select current_date + 7;

The original question (if I remember correctly; have zapped it now) was 
about adding an integer to a timestamp, hence the need to truncate it to 
a date first as in Adrian's example above.

Ray.

-- 
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie



pgsql-general by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: ERROR: operator does not exist: timestamp without time zone + integer
Next
From: Adrian Klaver
Date:
Subject: Re: Amazon Linux Support?