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).

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to