now() + '4d' AT TIME ZONE issue

Поиск
Список
Период
Сортировка
От Madison Kelly
Тема now() + '4d' AT TIME ZONE issue
Дата
Msg-id 4A54E671.6040602@alteeve.com
обсуждение исходный текст
Ответы Re: now() + '4d' AT TIME ZONE issue
Re: now() + '4d' AT TIME ZONE issue
Список pgsql-general
Hi all,

   I'm trying to select an offset timestamp at a given time zone, but I
can't seem to get the syntax right.

What I am *trying* to do, which doesn't work:

SELECT
    now() AT TIME ZONE 'America/Toronto',
    now() + '4d' AS future AT TIME ZONE 'America/Toronto';

Which generates the error:
ERROR:  syntax error at or near "AT"
LINE 1: ...ME ZONE 'America/Toronto', now() + '4d' AS future AT TIME ZO...

I've tried using an embedded SELECT and CASTing it as a TIMESTAMP with
no luck.

SELECT
    now() AT TIME ZONE 'America/Toronto',
    CAST ((SELECT now() + '4d') AS TIMESTAMP) as future AT TIME ZONE
'America/Toronto';
ERROR:  syntax error at or near "AT"
LINE 1: ...ST ((SELECT now() + '4d') AS TIMESTAMP) as future AT TIME ZO...

When I remove the 'AT TIME ZONE' from the offset now in either case the
SELECT works.

Someone mind beating me with a clue stick? Thanks!

Madi

В списке pgsql-general по дате отправления:

Предыдущее
От: Dan Armbrust
Дата:
Сообщение: Re: Checkpoint Tuning Question
Следующее
От: Ms swati chande
Дата:
Сообщение: Re: [Re: Password?]