'create or replace function' no longer allows parameters

Поиск
Список
Период
Сортировка
Искать
От
David Gardner
Тема
'create or replace function' no longer allows parameters
Дата
Msg-id
4C103808.9030502@creatureshop.com
Список
Дерево обсуждения
'create or replace function' no longer allows parameters David Gardner <dgardner@creatureshop.com>
Re: 'create or replace function' no longer allows parameters Alvaro Herrera <alvherre@commandprompt.com>
Re: 'create or replace function' no longer allows parameters Josh Berkus <josh@agliodbs.com>
Re: 'create or replace function' no longer allows parameters Robert Haas <robertmhaas@gmail.com>
In 8.4.4 I used to be able to rename input parameters via "create or 
replace function".
In 9.0 beta2  this no longer is allowed, and I get a descriptive message 
informing me to use
drop function instead, but I couldn't find this documented anywhere as a 
change between 8.4 and 9.0.
--------------
test=# CREATE FUNCTION test_plpgsql(IN a integer) RETURNS integer AS
test-# $BODY$
test$# BEGIN
test$#     RETURN $1;
test$# END;
test$# $BODY$
test-# LANGUAGE 'plpgsql' STABLE;
CREATE FUNCTION
test=# SELECT * FROM  test_plpgsql(34); test_plpgsql
--------------           34
(1 row)

test=# CREATE OR REPLACE FUNCTION test_plpgsql(IN b integer) RETURNS 
integer AS
$BODY$
BEGIN    RETURN $1;
END;
$BODY$
LANGUAGE 'plpgsql' STABLE;
CREATE FUNCTION
test=# SELECT * FROM  test_plpgsql(34); test_plpgsql
--------------           34
(1 row)

test=# \df+ test_plpgsql                                                             List of 
functions Schema |     Name     | Result data type | Argument data types |  
Type  | Volatility |  Owner   | Language |  Source code   | Description
--------+--------------+------------------+---------------------+--------+------------+----------+----------+----------------+------------- public | test_plpgsql | integer          | b integer           | 
normal | stable     | dgardner | plpgsql  |                |                                                                                                            : BEGIN                                                                                                            :     RETURN $1;                                                                                                            : END;                                                                                                            :
(1 row)
-----------------------

psql (9.0beta2)
Type "help" for help.

test=# CREATE FUNCTION test_plpgsql(IN a integer) RETURNS integer AS
test-# $BODY$
test$# BEGIN
test$#     RETURN $1;
test$# END;
test$# $BODY$
test-# LANGUAGE 'plpgsql' STABLE;
CREATE FUNCTION
test=# CREATE OR REPLACE FUNCTION test_plpgsql(IN b integer) RETURNS 
integer AS
test-# $BODY$
test$# BEGIN
test$#     RETURN $1;
test$# END;
test$# $BODY$
test-# LANGUAGE 'plpgsql' STABLE;
ERROR:  cannot change name of input parameter "a"
HINT:  Use DROP FUNCTION first.

-- 
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
dgardner@creatureshop.com



В списке pgsql-hackers по дате отправления
От: Takahiro Itagaki
Дата:
От: Robert Haas
Дата:
FAQ