Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID
Date
Msg-id 20230208063316.atjv6uxb7owm77s6@jrouhaud
Whole thread Raw
In response to possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID
List pgsql-hackers
On Tue, Feb 07, 2023 at 08:48:22PM +0100, Pavel Stehule wrote:
>
> I have a question about the possibility of simply getting the name of the
> currently executed function. The reason for this request is simplification
> of writing debug messages.
>
> GET DIAGNOSTICS _oid = PG_ROUTINE_OID;
> RAISE NOTICE '... % ... %', _oid, _oid::regproc::text;
>
> The advantage of this dynamic access to function name is always valid value
> not sensitive to some renaming or moving between schemas.
>
> I am able to separate a name from context, but it can be harder to write
> this separation really robustly. It can be very easy to enhance the GET
> DIAGNOSTICS statement to return the oid of currently executed function.
>
> Do you think it can be useful feature?

+1, it would have been quite handy in a few of my projects.



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: A bug in make_outerjoininfo
Next
From: Andres Freund
Date:
Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)