From: Семёнов Михаил <m7onov@yandex.ru>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Function modification visibility in parallel connection
Date: Tue, 27 Sep 2022 18:01:15 +0100
Message-ID: <1205251664297977@mail.yandex.ru> (raw)
<div><div>Hello guys.</div><div>I'm facing the following problem which seems to me a bug. Postgres version used - 13.7</div><div> </div><div>1) Connection1:</div><div>create or replace function test_fn() returns text as $$</div><div>begin</div><div> return 'version1';</div><div>end;</div><div>$$ language plpgsql;</div><div> </div><div>2) Connection2:</div><div>begin;</div><div>select test_fn();</div><div> test_fn</div><div>---------</div><div> version1</div><div>(1 row)</div><div> </div><div>3) Connection1:</div><div>create or replace function test_fn() returns text as $$</div><div>begin</div><div> return 'version2';</div><div>end;</div><div>$$ language plpgsql;</div><div> </div><div>4) Connection2:</div><div>select test_fn();</div><div> test_fn</div><div>---------</div><div> version1</div><div>(1 row)</div><div> </div><div>So the question is why Connection2 does not see updated version of test_fn? I've looked at source code and found that system cache invalidations (PROCOID cache in this case) occurs in AcceptInvalidationMessages() call chain. This function is called in a plenty of places but not when we call function in a running transaction as in the example. My thought is that AcceptInvalidationMessages() should be called in xact.c --> StartTransactionCommand() for TBLOCK_INPROGRESS, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_SUBINPROGRESS cases. Am I right or is it not even a bug?</div></div>
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: m7onov@yandex.ru, pgsql-bugs@lists.postgresql.org
Subject: Re: Function modification visibility in parallel connection
In-Reply-To: <1205251664297977@mail.yandex.ru>
* 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