Re: plpgsql extract epoch problem

Поиск
Список
Период
Сортировка
От Darren Ferguson
Тема Re: plpgsql extract epoch problem
Дата
Msg-id 3F96B9C1.2030506@crystalballinc.com
обсуждение исходный текст
Ответ на plpgsql extract epoch problem  (Darren Ferguson <darren@crystalballinc.com>)
Список pgsql-general
Sorry found the answer
I was taking the docs to literal

It should be extract(epoch from _test)

Sorry for the email
Darren

Darren Ferguson wrote:

> Hey all
>
> I am trying to extract the epoch from a timestamp variable in plpgsql.
> The function is as follows:
>
> create or replace function test() returns integer as '
> declare
>  _test timestamp with time zone;
>  _f integer;
> begin
>  _test := current_timestamp;
>  _f := extract(epoch from timestamp _test);
>  return _f;
> end;' language 'plpgsql';
>
> Any ideas why this will not work????
>
> The error is as follows:
> pts=> select test();
> WARNING:  Error occurred while executing PL/pgSQL function test
> WARNING:  line 6 at assignment
> ERROR:  parser: parse error at or near "$1" at character 40
>
> And that is the _test variable
>
> Any help greatly apprechiated
> Darren
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly



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

Предыдущее
От: Darren Ferguson
Дата:
Сообщение: plpgsql extract epoch problem
Следующее
От: "Eric Dahnke"
Дата:
Сообщение: Prepared Statements