Function modification visibility in parallel connection

From: Семёнов Михаил <m7onov(at)yandex(dot)ru>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Function modification visibility in parallel connection
Date: 2022-09-27 17:01:15
Message-ID: 1205251664297977@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<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 --&gt; StartTransactionCommand() for TBLOCK_INPROGRESS, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_SUBINPROGRESS cases. Am I right or is it not even a bug?</div></div>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2022-09-27 17:58:09 Re: BUG #17619: AllocSizeIsValid violation in parallel hash join
Previous Message Peter Geoghegan 2022-09-27 16:55:57 Re: BUG #17619: AllocSizeIsValid violation in parallel hash join