Re: Fix bug with accessing to temporary tables of other sessions

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Soumya S Murali <soumyamurali(dot)work(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stepan Neretin <slpmcf(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix bug with accessing to temporary tables of other sessions
Date: 2026-04-21 13:17:15
Message-ID: CAJDiXghO6LHTXjW3z7wNYNkX=e9SMNnkLVQmN_RHQpYJAABF=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Apr 21, 2026 at 3:07 AM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> I've checked the thread. Thanks to all the participants for their
> work. I think there is a general agreement on the design.
>
> I see the patch changes the error wording. Previously the error was
> "cannot access temporary tables of other sessions", but we change it
> to "cannot access temporary relation of other sessions". I see the
> intention here: we trigger an error while accessing some relation (not
> necessarily a table) then we should reflect this directly to the error
> message. However, old message is already here for quite a while and
> translated into many languages. Also, is old message incorrect? We
> trigger an error on buffer access. That is, we trigger an error only
> for relation with a storage: table, index, sequence or matview.
> Matview can't be temporary. Also, if you access an index with a
> query, that means you're querying its table. But sequence can be
> temporary and it can be not directly associated with a table. So,
> yes, new error message is more correct.

Thank you very much for the review!

> But I would prefer to make it
> a separate patch, and replace all the occurrences including contrib.

OK, no problem.
BTW, do I understand correctly that I don't need to touch the .po files?

I have also noticed this code in the localbuf.c :
```
if (IsParallelWorker())
ereport(ERROR,
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
errmsg("cannot access temporary tables during a
parallel operation")));
```
This code is related to initialization of local buffers which can be performed
not only for tables, obviously. Since this is a small step away from our
original idea, I'll fix it in a separate patch. IMHO it will be an appropriate
fix since we have already taken on this task. Looking forward to your comments.

--
Best regards,
Daniil Davydov

Attachment Content-Type Size
v1-0001-Improve-error-message-for-other-sessions-temporar.patch text/x-patch 6.2 KB
v1-0002-Improve-error-message-for-accessing-temp-buffers-.patch text/x-patch 1.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matheus Alcantara 2026-04-21 13:20:50 Re: MERGE PARTITIONS and DEPENDS ON EXTENSION.
Previous Message Etsuro Fujita 2026-04-21 13:09:00 Re: [PATCH] Fix column name escaping in postgres_fdw stats import