pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jacques@quantsolutions.co.za
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18456: Trigger data in plpython3u trigger-function changes in AFTER UPDATE OR INSERT trigger
Date: Sat, 04 May 2024 14:34:40 -0400
Message-ID: <2944262.1714847680@sss.pgh.pa.us> (raw)
In-Reply-To: <18456-82d3d70134aefd28@postgresql.org>
References: <18456-82d3d70134aefd28@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> Then the trigger data changes after the insert statement in the trigger
> function.

Hmm.  TD is defined as a global dictionary like SD, so it saves values
across calls to the plpython function.  So the inner INSERT operation
fires the same trigger, which decides not to print anything, but
nonetheless it's changed TD and the outer trigger call will see that.

There used to be similar problems in plain plpython functions if they
were invoked recursively, because named function arguments are also
passed as global variables.  We fixed that in a rather hacky way in
1d2fe56e4, ie save and restore those globals when recursing.
Probably the same thing could be done with TD.

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <2944262.1714847680@sss.pgh.pa.us>
Permalink:  ../2944262.1714847680@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2944262.1714847680@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, jacques@quantsolutions.co.za, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18456: Trigger data in plpython3u trigger-function changes in AFTER UPDATE OR INSERT trigger
  In-Reply-To: <2944262.1714847680@sss.pgh.pa.us>

* 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