pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a way to get the current function's OID in pl/pgsql.
Date: Tue, 04 Apr 2023 17:33:22 +0000
Message-ID: <E1pjkX2-001M2a-UE@gemulon.postgresql.org> (raw)

Add a way to get the current function's OID in pl/pgsql.

Invent "GET DIAGNOSTICS oid_variable = PG_ROUTINE_OID".
This is useful for avoiding the maintenance nuisances that come
with embedding a function's name in its body, as one might do
for logging purposes for example.  Typically users would cast the
result to regproc or regprocedure to get something human-readable,
but we won't pre-judge whether that's appropriate.

Pavel Stehule, reviewed by Kirk Wolak and myself

Discussion: https://postgr.es/m/CAFj8pRA4zMd5pY-B89Gm64bDLRt-L+akOd34aD1j4PEstHHSVQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d3d53f955cf6ad755ba3682577e0f6fa10106438

Modified Files
--------------
doc/src/sgml/plpgsql.sgml                 |  5 +++++
src/pl/plpgsql/src/pl_exec.c              |  6 ++++++
src/pl/plpgsql/src/pl_funcs.c             |  2 ++
src/pl/plpgsql/src/pl_gram.y              |  6 ++++++
src/pl/plpgsql/src/pl_unreserved_kwlist.h |  1 +
src/pl/plpgsql/src/plpgsql.h              |  1 +
src/test/regress/expected/plpgsql.out     | 31 +++++++++++++++++++++++++++++--
src/test/regress/sql/plpgsql.sql          | 29 +++++++++++++++++++++++++++--
8 files changed, 77 insertions(+), 4 deletions(-)



Message-ID: <E1pjkX2-001M2a-UE@gemulon.postgresql.org>
Permalink:  ../E1pjkX2-001M2a-UE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pjkX2-001M2a-UE@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add a way to get the current function's OID in pl/pgsql.
  In-Reply-To: <E1pjkX2-001M2a-UE@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox