pg_prepared_xacts returns transactions that are foreign to the caller

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_prepared_xacts returns transactions that are foreign to the caller
Date: 2024-11-20 07:48:22
Message-ID: CAB=Je-FN4u6Xb8D3eY7qWAbfhEvM-8fpWb-cLKJuxVC=5tMFtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

"select * from pg_prepared_xacts" might produce transactions created by a
different user, so the caller won't be able to issue "commit prepared".

I think there should be a view that returns only the transactions that the
caller can commit or rollback.
Is it something that can be implemented at the backend?

Currently, the backend checks owner and database when user calls "commit
prepared", so I believe the similar filter should be implemented in
pg_prepared_xacts view:
https://github.com/postgres/postgres/blob/15afb7d61c142a9254a6612c6774aff4f358fb69/src/backend/access/transam/twophase.c#L583C32-L599

Vladimir

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2024-11-20 07:58:43 Re: PGSERVICEFILE as part of a normal connection string
Previous Message jian he 2024-11-20 07:29:22 Re: Support LIKE with nondeterministic collations