Hi,
If function is created with the LEAKPROOF option, then pg_get_functiondef() does not show that in the returned definition.
Is it expected OR are we missing that option in pg_get_functiondef().
However only superuser can define a leakproof function.
Was this the reson we are not showing that in pg_get_functiondef() output?
I don't think we should hide this detail.
Here is the sample testcase to reproduce the issue:
postgres=# CREATE OR REPLACE FUNCTION foobar(i integer) RETURNS integer AS $$
BEGIN
RETURN i + 1;
END;
$$
STRICT
LEAKPROOF
LANGUAGE plpgsql;
CREATE FUNCTION
postgres=# select pg_get_functiondef((select oid from pg_proc where proname = 'foobar'));
pg_get_functiondef
-----------------------------------------------------
CREATE OR REPLACE FUNCTION public.foobar(i integer)+
RETURNS integer +
LANGUAGE plpgsql +
STRICT +
AS $function$ +
BEGIN +
RETURN i + 1; +
END; +
$function$ +
(1 row)
postgres=# select proname, proleakproof from pg_proc where proname = 'foobar';
proname | proleakproof
---------+--------------
foobar | t
(1 row)
Attached patch which adds that in pg_get_functiondef().
--
Jeevan B Chalke
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company