From: | "Raman Garg" <ramang(at)smartdatainc(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Query TIME ZONE |
Date: | 2004-01-28 06:09:23 |
Message-ID: | 008c01c3e565$7c2baac0$d4c7a8c0@raman |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thanks Tom it worked for me...
yes I got it wrong.. thanks for the correction.
thanks a lot..
-- Raman
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Raman" <ramang(at)smartdatainc(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Wednesday, January 28, 2004 11:28 AM
Subject: Re: [SQL] Query TIME ZONE
> "Raman" <ramang(at)smartdatainc(dot)com> writes:
> > [ okay: ]
> > "select current_time AT TIME ZONE INTERVAL '+5:30'"
> > [ not okay: ]
> > "select current_time AT TIME ZONE INTERVAL time_difference from
customer_events"
>
> "TIME ZONE INTERVAL" is not a SQL construct. You have misunderstood the
> interaction of two different SQL constructs:
> timestamp AT TIME ZONE timezonespec
> INTERVAL 'interval-literal'
> One of the possible forms of "timezonespec" in the AT TIME ZONE operator
> is an interval value, so your first example works fine. Your second
> example does not work because the INTERVAL 'foo' construct is only for
> simple literal constants.
>
> > here : time_difference - is my varchar column in the table
customer_events.
>
> Why are you using varchar rather than an interval column? An interval
> value would work directly in this construct and would provide some
> checking that entered values are sane.
>
> If you are absolutely intent on using varchar as the column datatype,
> you can do a run-time cast like this:
> select current_time AT TIME ZONE "interval"(time_difference) from
customer_events
> but don't complain when the query fails because some rows contain
> time_difference strings that don't look like legal interval values...
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | j knight | 2004-01-28 06:36:55 | Aggregate function error in 7.4 |
Previous Message | Tom Lane | 2004-01-28 05:58:32 | Re: Query TIME ZONE |