From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Ralph Smith <smithrn(at)washington(dot)edu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Script errors on run |
Date: | 2008-06-04 21:56:52 |
Message-ID: | 20080604144315.S80762@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 4 Jun 2008, Ralph Smith wrote:
> -- ==========================================
> good_date := to_date(year||'-'||month||'-'||day , 'YYYY-MM-DD') ;
> RAISE NOTICE 'good_date = %',good_date ;
> Usecs := EXTRACT(EPOCH FROM TIMESTAMP good_date) ;
> END ;
>
> QUERY: SELECT EXTRACT(EPOCH FROM TIMESTAMP $1 )
> CONTEXT: SQL statement in PL/PgSQL function "usecs_from_date" near
> line 92
>
> Is this not a programmable extraction???
> I'm missing something here.
TIMESTAMP '...' describes a timestamp literal.
If you wanted to explicitly cast the value in good_date as a timestamp,
you'd probably want CAST(good_date AS TIMESTAMP).
If good_date is of type date, however, I believe the cast to timestamp is
implicit, so you should probably be able to just use extract(epoch from
good_date).
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Long | 2008-06-04 21:56:55 | full vacuum really slows down query |
Previous Message | Michael Glaesemann | 2008-06-04 21:56:23 | Re: functions, transactions, key violations |