Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID
Julien Rouhaud <rjuju123@gmail.com>
From: Julien Rouhaud <rjuju123@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-02-08T06:33:16Z
Lists: 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.
Commits
-
Add a way to get the current function's OID in pl/pgsql.
- d3d53f955cf6 16.0 landed