Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.

From: Philippe BEAUDOIN <phb(dot)emaj(at)free(dot)fr>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.
Date: 2025-01-07 15:54:07
Message-ID: e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Le 07/01/2025 à 12:27, Pavel Stehule a écrit :
> If you want to understand to these details, you should to look to
> source code
>
> https://github.com/postgres/postgres/tree/master/src/pl/plpgsql/src
>
> fn_signature is calculated in compile time - this is when the function
> is first time executed in session. Until the end of session or
> function change, the interpreter uses already compiled AST from cache
> and doesn't try to call the compiler (or more correctly named -
> parser). So the behavior depends on the state when the function was
> executed the first time. It can be more complex when a function uses
> polymorphic parameters, because then there can be cached more
> instances of one function.
>
> The reason why signature is calculated only at compile time is just
> performance. Any access to the system catalog has its own cost, and
> you don't want to execute it again and again when the function is
> started. It cannot be executed at exception time (when it is usually
> used), because at this time it is impossible to access the system catalog.
>
>
> Regards
>
> Pavel
>
Ah, this clearly explains the strange to me things I noted. Thanks a lot
for the explanation.

This closes the issue.

Regards. Philippe.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Torbjörn Gannholm 2025-01-07 17:51:20 Incorrect result in certain expressions of anti-join
Previous Message Aleksander Alekseev 2025-01-07 12:39:07 Re: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres'