summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-04-04 13:33:18 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-04-04 13:33:18 -0400
commitd3d53f955cf6ad755ba3682577e0f6fa10106438 (patch)
tree8572b2e5db878d357c9a350ae61b098451d7f5ba /doc/src
parent482675987bcdffb390ae735cfd5f34b485ae97c6 (diff)
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
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/plpgsql.sgml5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 7c8a49fe435..f55e901c7e5 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -1639,6 +1639,11 @@ GET DIAGNOSTICS integer_var = ROW_COUNT;
<entry>line(s) of text describing the current call stack
(see <xref linkend="plpgsql-call-stack"/>)</entry>
</row>
+ <row>
+ <entry><literal>PG_ROUTINE_OID</literal></entry>
+ <entry><type>oid</type></entry>
+ <entry>OID of the current function</entry>
+ </row>
</tbody>
</tgroup>
</table>