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
dgard...@creatureshop.com



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to