REPACK in a READ ONLY transaction: is it intended ?

Started by dinesh kumar5 days ago1 messagesgeneral
Jump to latest
#1dinesh kumar
dineshkumar02@gmail.com

Hello Everyone,

On PostgreSQL 19.0, REPACK runs inside a READ ONLY transaction:

SELECT pg_relation_filenode('t'); -- 25599

START TRANSACTION READ ONLY;
INSERT INTO t VALUES (0, 'x');
ERROR: cannot execute INSERT in a read-only transaction
ROLLBACK;

START TRANSACTION READ ONLY;
REPACK t; -- succeeds, AccessExclusiveLock
COMMIT;

SELECT pg_relation_filenode('t'); -- 25607

I have a slight concern here, as the READ ONLY transaction is often
considered safe on a
production server, and this one takes an exclusive lock. Would anyone
suggest if we are missing anything here, please?..

Thank you.
--

Regards,
Dinesh
pgSherpa - https://cortexridge.com/