Postgres 9 alpha 5 revised, stored proc

Поиск
Список
Период
Сортировка
От Andy Colson
Тема Postgres 9 alpha 5 revised, stored proc
Дата
Msg-id 4BBD312C.7030504@squeakycode.net
обсуждение исходный текст
Ответы Re: Postgres 9 alpha 5 revised, stored proc
Список pgsql-general
I have this stored proc that works in pg 8.4.


create or replace function roundts(ts timestamp) returns timestamp as $$
declare
    tmp integer;
    result timestamp;
    offset interval;
begin
    tmp := extract(second from ts);
    if tmp > 30 then
        tmp := 60 - tmp;
        offset := tmp || ' seconds';
        result := ts + offset;
    else
        offset := tmp || ' seconds';
        result := ts - offset;
    end if;

    tmp := extract(minute from result);
    if tmp > 30 then
        tmp := 60 - tmp;
        offset := tmp || ' minutes';
        result := result + offset;
    else
        offset := tmp || ' minutes';
        result := result - offset;
    end if;

    return result;
end; $$ language plpgsql;


In 9 I get an error when trying to create it:

$ psql < roundts.sql
Timing is on.
CREATE FUNCTION
Time: 26.716 ms
ERROR:  syntax error at or near "offset"
LINE 11:   result := ts + offset;
                           ^

Just wanted to report it.

-Andy

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

Предыдущее
От: Gordan Bobic
Дата:
Сообщение: Re: Solid State Drives with PG
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgres 9 alpha 5 revised, stored proc