public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pavel Stehule <[email protected]>
To: Kirk Wolak <[email protected]>
Cc: Julien Rouhaud <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID
Date: Mon, 27 Mar 2023 08:29:29 +0200
Message-ID: <CAFj8pRD6ti-bsYH_tObUNznZ_kiPcvDnty0oLW5j2MoGnODoFQ@mail.gmail.com> (raw)
In-Reply-To: <CACLU5mSgxBXphh_rN-7r3iXjq4ymEtcBsibHwVR0kvLJKQwD9g@mail.gmail.com>
References: <CAFj8pRA4zMd5pY-B89Gm64bDLRt-L+akOd34aD1j4PEstHHSVQ@mail.gmail.com>
<20230208063316.atjv6uxb7owm77s6@jrouhaud>
<CAFj8pRBEwu3FwFvjOn0oB9hO0Rnipzko9r0bHj248CJgowza6w@mail.gmail.com>
<CACLU5mSUj9cbGB9wQAABnOgYGUg95awzBhhTB1P79fL-NfYTDw@mail.gmail.com>
<CACLU5mRkaePuCMqiFVKg54jTn1PjT-mCnj-2zvUaKA3sHr0MCg@mail.gmail.com>
<CACLU5mSgxBXphh_rN-7r3iXjq4ymEtcBsibHwVR0kvLJKQwD9g@mail.gmail.com>
Hi
po 27. 3. 2023 v 5:36 odesílatel Kirk Wolak <[email protected]> napsal:
> On Sun, Mar 26, 2023 at 5:37 PM Kirk Wolak <[email protected]> wrote:
>
>> On Wed, Feb 8, 2023 at 10:56 AM Kirk Wolak <[email protected]> wrote:
>>
>>> On Wed, Feb 8, 2023 at 3:08 AM Pavel Stehule <[email protected]>
>>> wrote:
>>>
>>>> hi
>>>>
>>>> st 8. 2. 2023 v 7:33 odesílatel Julien Rouhaud <[email protected]>
>>>> napsal:
>>>>
>>>>> On Tue, Feb 07, 2023 at 08:48:22PM +0100, Pavel Stehule wrote:
>>>>> >
>>>>> > GET DIAGNOSTICS _oid = PG_ROUTINE_OID;
>>>>> > RAISE NOTICE '... % ... %', _oid, _oid::regproc::text;
>>>>> >
>>>>> > Do you think it can be useful feature?
>>>>>
>>>>> +1, it would have been quite handy in a few of my projects.
>>>>>
>>>>
>>>> it can looks like that
>>>>
>>>> create or replace function foo(a int)
>>>> returns int as $$
>>>> declare s text; n text; o oid;
>>>> begin
>>>> get diagnostics s = pg_current_routine_signature,
>>>> n = pg_current_routine_name,
>>>> o = pg_current_routine_oid;
>>>> raise notice 'sign:%, name:%, oid:%', s, n, o;
>>>> return a;
>>>> end;
>>>> $$ language plpgsql;
>>>> CREATE FUNCTION
>>>> (2023-02-08 09:04:03) postgres=# select foo(10);
>>>> NOTICE: sign:foo(integer), name:foo, oid:16392
>>>> ┌─────┐
>>>> │ foo │
>>>> ╞═════╡
>>>> │ 10 │
>>>> └─────┘
>>>> (1 row)
>>>>
>>>> The name - pg_routine_oid can be confusing, because there is not clean
>>>> if it is oid of currently executed routine or routine from top of exception
>>>>
>>>> Regards
>>>>
>>>> Pavel
>>>>
>>>
>>> I agree that the name changed to pg_current_routine_... makes the most
>>> sense, great call...
>>>
>>> +1
>>>
>>
>> Okay, I reviewed this. I tested it (allocating too small of
>> varchar's for values, various "signature types"),
>> and also a performance test... Wow, on my VM, 10,000 Calls in a loop was
>> 2-4ms...
>>
>> The names are clear. Again, I tested with various options, and including
>> ROW_COUNT, or not.
>>
>> This functions PERFECTLY.... Except there are no documentation changes.
>> Because of that, I set it to Waiting on Author.
>> Which might be unfair, because I could take a stab at doing the
>> documentation (but docs are not compiling on my setup yet).
>>
>> The documentation changes are simple enough.
>> If I can get the docs compiled on my rig, I will see if I can make the
>> changes, and post an updated patch,
>> that contains both...
>>
>> But I don't want to be stepping on toes, or having it look like I am
>> taking credit.
>>
>> Regards - Kirk
>>
>
> Okay, I have modified the documentation and made sure it compiles. They
> were simple enough changes.
> I am attaching this updated patch.
>
> I have marked the item Ready for Commiter...
>
Thank you for doc and for review
Regards
Pavel
>
> Thanks for your patience. I now have a workable hacking environment!
>
> Regards - Kirk
>
>
view thread (10+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: possible proposal plpgsql GET DIAGNOSTICS oid = PG_ROUTINE_OID
In-Reply-To: <CAFj8pRD6ti-bsYH_tObUNznZ_kiPcvDnty0oLW5j2MoGnODoFQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox