Re: Script errors on run

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Script errors on run
Дата
Msg-id 20080604144315.S80762@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Script errors on run  (Ralph Smith <smithrn@washington.edu>)
Ответы Re: Script errors on run  (Ralph Smith <smithrn@washington.edu>)
Список 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).

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: functions, transactions, key violations
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: functions, transactions, key violations