pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: 857348270@qq.com
Subject: BUG #17837: The potential risks associated with executing "commit" in a procedure.
Date: Mon, 13 Mar 2023 12:40:11 +0000
Message-ID: <17837-9e65be9846767162@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17837
Logged by:          Andre Lin
Email address:      857348270@qq.com
PostgreSQL version: 12.14
Operating system:   Linux x86_64 GNU/Linux
Description:        

Recently, I have noticed that executing "commit" in a procedure calls
PreCommit_Portals in the kernel, which sets the resowner of the top level
portal to null. However, subsequent statements still use this portal, and
its resowner remains null. Is there any risk associated with this or could
it lead to unexpected behavior? If this is expected, how should I interpret
(or ... understand) portal->resowner? I would greatly appreciate your
guidance on this matter.

For example:

create or replace procedure p () 
as
$$
    declare
    vsql varchar := 'aa';
    begin
        for i in 1..10
        loop
            raise notice '%',i;
        end loop;
    commit;
        for i in 1..10
        loop
        raise notice '%',i;
        end loop;
    commit;
end;
$$
language plpgsql;



view thread (2+ messages)  latest in thread

Message-ID: <17837-9e65be9846767162@postgresql.org>
Permalink:  ../17837-9e65be9846767162@postgresql.org/
Also on:    postgresql.org/message-id/17837-9e65be9846767162@postgresql.org

 · 

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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, 857348270@qq.com
  Subject: Re: BUG #17837: The potential risks associated with executing "commit" in a procedure.
  In-Reply-To: <17837-9e65be9846767162@postgresql.org>

* 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