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

From: "Chris Spotts" <rfusca(at)gmail(dot)com>
To: "'Madison Kelly'" <linux(at)alteeve(dot)com>, "'postgres list'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: now() + '4d' AT TIME ZONE issue
Date: 2009-07-08 18:41:46
Message-ID: 005201c9fffb$c07d96a0$4178c3e0$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Try moving your "as future"
SELECT
now() AT TIME ZONE 'America/Toronto',
CAST ((SELECT now() + '4d') AS TIMESTAMP) AT TIME ZONE 'America/Toronto' as future;

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Madison Kelly
> Sent: Wednesday, July 08, 2009 1:33 PM
> To: postgres list
> Subject: [GENERAL] now() + '4d' AT TIME ZONE issue
>
> 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
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-07-08 18:44:43 Re: Checkpoint Tuning Question
Previous Message Ms swati chande 2009-07-08 18:34:01 Re: [Re: Password?]