mirror of
https://github.com/postgres/postgres.git
synced 2026-01-13 12:22:55 +03:00
Defend against possible crash if a plpython function does not specify names
for its arguments. Also add a regression test, since someone apparently changed every single plpython test case to use only named parameters; else we'd have noticed this sooner. Euler Taveira de Oliveira, per a report from Alvaro
This commit is contained in:
@@ -357,8 +357,11 @@ CREATE FUNCTION test_return_none() RETURNS int AS $$
|
||||
None
|
||||
$$ LANGUAGE plpythonu;
|
||||
--
|
||||
-- Test named parameters
|
||||
-- Test named and nameless parameters
|
||||
--
|
||||
CREATE FUNCTION test_param_names0(integer, integer) RETURNS int AS $$
|
||||
return args[0] + args[1]
|
||||
$$ LANGUAGE plpythonu;
|
||||
CREATE FUNCTION test_param_names1(a0 integer, a1 text) RETURNS boolean AS $$
|
||||
assert a0 == args[0]
|
||||
assert a1 == args[1]
|
||||
|
||||
@@ -197,7 +197,13 @@ SELECT test_return_none(), test_return_none() IS NULL AS "is null";
|
||||
| t
|
||||
(1 row)
|
||||
|
||||
-- Test for functions with named parameters
|
||||
-- Test for functions with named and nameless parameters
|
||||
SELECT test_param_names0(2,7);
|
||||
test_param_names0
|
||||
-------------------
|
||||
9
|
||||
(1 row)
|
||||
|
||||
SELECT test_param_names1(1,'text');
|
||||
test_param_names1
|
||||
-------------------
|
||||
|
||||
Reference in New Issue
Block a user