Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kirk Wolak <wolakk@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-04-04T16:57:12Z
Lists: pgsql-hackers

Attachments

út 4. 4. 2023 v 16:20 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

> Pavel Stehule <pavel.stehule@gmail.com> writes:
> > There is reduced patch + regress tests
>
> One more thing: I do not think it's appropriate to allow this in
> GET STACKED DIAGNOSTICS.  That's about reporting the place where
> an error occurred, not the current location.  Eventually it might
> be interesting to retrieve the OID of the function that contained
> the error, but that would be a pretty complicated patch and I am
> not sure it's worth it.  In the meantime I think we should just
> forbid it.
>
> If we do that, then the confusion you were concerned about upthread
> goes away and we could shorten the keyword back down to "pg_routine_oid",
> which seems like a good thing for our carpal tunnels.
>
> Thoughts?
>

has sense

updated patch attached

Regards

Pavel

>
>                         regards, tom lane
>

Commits

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