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

Поиск
Список
Период
Сортировка
От Ray O'Donnell
Тема Re: ERROR: operator does not exist: timestamp without time zone +integer
Дата
Msg-id df556cf3-6cb8-6e9f-6585-8c3e045bccc0@rodonnell.ie
обсуждение исходный текст
Ответ на Re: ERROR: operator does not exist: timestamp without time zone + integer  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список 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 по дате отправления:

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: ERROR: operator does not exist: timestamp without time zone + integer
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Amazon Linux Support?