mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Allow ALTER FUNCTION to change a function's strictness, volatility, and
whether or not it is a security definer. Changing a function's strictness is required by SQL2003, and the other capabilities make sense. Also, allow an optional RESTRICT noise word to be specified, for SQL conformance. Some trivial regression tests added and the documentation has been updated.
This commit is contained in:
@@ -1235,3 +1235,38 @@ select * from another;
|
||||
(3 rows)
|
||||
|
||||
drop table another;
|
||||
--
|
||||
-- alter function
|
||||
--
|
||||
create function test_strict(text) returns text as
|
||||
'select coalesce($1, ''got passed a null'');'
|
||||
language sql returns null on null input;
|
||||
select test_strict(NULL);
|
||||
test_strict
|
||||
-------------
|
||||
|
||||
(1 row)
|
||||
|
||||
alter function test_strict(text) called on null input;
|
||||
select test_strict(NULL);
|
||||
test_strict
|
||||
-------------------
|
||||
got passed a null
|
||||
(1 row)
|
||||
|
||||
create function non_strict(text) returns text as
|
||||
'select coalesce($1, ''got passed a null'');'
|
||||
language sql called on null input;
|
||||
select non_strict(NULL);
|
||||
non_strict
|
||||
-------------------
|
||||
got passed a null
|
||||
(1 row)
|
||||
|
||||
alter function non_strict(text) returns null on null input;
|
||||
select non_strict(NULL);
|
||||
non_strict
|
||||
------------
|
||||
|
||||
(1 row)
|
||||
|
||||
|
||||
@@ -975,3 +975,20 @@ alter table another
|
||||
select * from another;
|
||||
|
||||
drop table another;
|
||||
|
||||
--
|
||||
-- alter function
|
||||
--
|
||||
create function test_strict(text) returns text as
|
||||
'select coalesce($1, ''got passed a null'');'
|
||||
language sql returns null on null input;
|
||||
select test_strict(NULL);
|
||||
alter function test_strict(text) called on null input;
|
||||
select test_strict(NULL);
|
||||
|
||||
create function non_strict(text) returns text as
|
||||
'select coalesce($1, ''got passed a null'');'
|
||||
language sql called on null input;
|
||||
select non_strict(NULL);
|
||||
alter function non_strict(text) returns null on null input;
|
||||
select non_strict(NULL);
|
||||
Reference in New Issue
Block a user