again, pgplsql and parameters question

Поиск
Список
Период
Сортировка
От Alex Sandini
Тема again, pgplsql and parameters question
Дата
Msg-id 3D81F301.1090403@keyware.com
обсуждение исходный текст
Список pgsql-general
Soory for this retry, here it is

With pg 7.1.3,

I don't get parameters working in my pgplsql functions.
I.e.:

CREATE FUNCTION add_one (INTEGER) RETURNS INTEGER AS '
BEGIN
RETURN ($1 + 1);
END;
' LANGUAGE 'plpgsql';

Gives:
ERROR: Unable to identify left operator '+' for type 'int4'
        You may need to add parentheses or an explicit cast

While the following one works just fine.

CREATE FUNCTION startweek() RETURNS DATE AS '
DECLARE
start date;
BEGIN
start:= to_date(''01-01-''||date_part(''year'', timestamp ''now''),''DD
MM YYYY'') + date_part(''week'', timestamp ''now'') * 7 - 8;
RETURN start;
END;
' LANGUAGE 'plpgsql';

ERROR: Unable to identify left operator '+' for type 'int4'
        You may need to add parentheses or an explicit cast


Any idea?
Thanks,
Alex


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

Предыдущее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: [HACKERS] MySQL wins award - makes amusing statement
Следующее
От: Justin Hawkins
Дата:
Сообщение: OID order = INSERT order?