Plpgsql Question

Поиск
Список
Период
Сортировка
От Oxeye
Тема Plpgsql Question
Дата
Msg-id 003301c1d73f$bac32ff0$05a8a8c0@oxeye
обсуждение исходный текст
Ответ на Performance Tuning Document?  (Matthew Kirkwood <matthew@hairy.beasts.org>)
Ответы Re: Plpgsql Question  ("Arguile" <arguile@lucentstudios.com>)
Список pgsql-general
Hello,

I'm new to Postgresql and plpgslq. I wrote a plpgsql to return epoch time
from a table, but had problem running it. The error returned:

NOTICE:  Error occurred while executing PL/pgSQL function sleeptime
NOTICE:  line 10 at assignment
ERROR:  Bad timestamp external representation 'rec_runtime.runtime'

My plpgsql function:

create function sleeptime () returns float as '
declare
        rec_runtime record;
        ret_sleepsecs float;
begin
        select into rec_runtime runtime from mon_nextrun order by runtime
limit 1;
        if rec_runtime.runtime is null
        then
            return 60;
        end if;
        ret_sleepsecs := extract (epoch from timestamp
''rec_runtime.runtime'') as float;
        return ret_sleepsecs;
end;
' language 'plpgsql';

What is the correct syntax for extract function in the assignment statement?

Thanks in advance.

-CT



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

Предыдущее
От: "Marin Dimitrov"
Дата:
Сообщение: Re: Performance Tuning Document?
Следующее
От: "Steve Wolfe"
Дата:
Сообщение: Re: Performance Tuning Document?