pg_get_functiondef() does not show LEAKPROOF for leakproof functions

From: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: pg_get_functiondef() does not show LEAKPROOF for leakproof functions
Date: 2015-05-28 08:52:35
Message-ID: CAM2+6=U5YLZBre3V3WF9FFuL0gxR1egA3MiPh1Gu0JPsEUD7dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

Attachment Content-Type Size
fix_leakproof_in_pg_get_functiondef.patch text/x-patch 569 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message feikesteenbergen 2015-05-28 10:07:05 BUG #13368: standby cluster immediately promotes after pg_basebackup from previously promoted master
Previous Message yashika.trivedi20 2015-05-28 06:50:14 BUG #13367: Calculate the each field of the table

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-05-28 09:17:48 Re: [COMMITTERS] pgsql: Add pg_audit, an auditing extension
Previous Message Etsuro Fujita 2015-05-28 08:20:53 Re: Re: 9.5 release notes may need ON CONFLICT DO NOTHING compatibility notice for FDW authors