pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philippe BEAUDOIN <phb.emaj@free.fr>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.
Date: Tue, 7 Jan 2025 16:54:07 +0100
Message-ID: <e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr> (raw)
In-Reply-To: <CAFj8pRA_0FF8HcXzn_Y3HJrZ9nGVj2RDaaf8umaKua-u5S0i1A@mail.gmail.com>
References: <18767-e36a4af08c98f883@postgresql.org>
	<CAFj8pRDHHcLFhaw+3-sdpg5g4tAe1726ghVV6Vfm+RkNm6=+LA@mail.gmail.com>
	<ba1819fb-1558-4c38-b7e5-6fe8f4b058f5@free.fr>
	<CAFj8pRA_0FF8HcXzn_Y3HJrZ9nGVj2RDaaf8umaKua-u5S0i1A@mail.gmail.com>

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.

view thread (5+ messages)

Message-ID: <e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr>
Permalink:  ../e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr/
Also on:    postgresql.org/message-id/e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr

 · 

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-bugs@postgresql.org
  Cc: phb.emaj@free.fr, pavel.stehule@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18767: Inconsistency in result of a Plpgsql GET DIAGNOSTICS PG_CONTEXT instruction.
  In-Reply-To: <e4def4d7-6ac7-48af-b0aa-ddb79df61f54@free.fr>

* 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