From: | David Gardner <dgardner(at)creatureshop(dot)com> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | 'create or replace function' no longer allows parameters |
Date: | 2010-06-10 00:55:36 |
Message-ID: | 4C103808.9030502@creatureshop.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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(at)creatureshop(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Takahiro Itagaki | 2010-06-10 00:58:05 | Re: failover vs. read only queries |
Previous Message | Robert Haas | 2010-06-10 00:45:48 | Re: parser handling of large object OIDs |