Accept invalidation messages before the query starts inside a transaction

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Accept invalidation messages before the query starts inside a transaction
Date: 2024-09-11 19:50:44
Message-ID: f618b3d6-13ab-4898-9569-1e2913c01360@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

During the PGDAY.Spain'2024 Yurii Rashkovskii found out boring behaviour
related to functions versioning:
If you open a transaction in one session and execute the function, then
replace this function with a new version or drop it in a concurrent
session; the first session doesn't see any changes: it will use the old
version of the function in the following query.
If you execute the function without explicit transaction, subsequent
query execution will employ the new version of the function.

It happens because of documented behaviour [1], which doesn't guarantee
isolation levels for internal access to the system catalogues. But it
looks more consistent for a user to see changes the same way with and
without explicit transactions, doesn't it? At least, an extension
developer may be confident that after updating to a new version, no one
user will employ the old version of the extension's function and not
think about the consequences it may cause.

I don't know whether to classify this as a bug. The sketch of the patch
with an example isolation test is attached.

[1] https://www.postgresql.org/docs/16/mvcc-caveats.html

--
regards, Andrei Lepikhov

Attachment Content-Type Size
0001-Accept-invalidation-messages-before-the-start-of-a-q.patch text/plain 3.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2024-09-11 19:52:26 Re: Document DateStyle effect on jsonpath string()
Previous Message Tom Lane 2024-09-11 19:43:05 Re: Document DateStyle effect on jsonpath string()