Prevent writes on large objects in read-only transactions

Поиск
Список
Период
Сортировка
От Yugo NAGATA
Тема Prevent writes on large objects in read-only transactions
Дата
Msg-id 20220527153028.61a4608f66abcd026fd3806f@sraoss.co.jp
обсуждение исходный текст
Ответы Re: Prevent writes on large objects in read-only transactions  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: Prevent writes on large objects in read-only transactions  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Hello,

Currently, lo_creat(e), lo_import, lo_unlink, lowrite, lo_put,
and lo_from_bytea are allowed even in read-only transactions.
By using them, pg_largeobject and pg_largeobject_metatable can
be modified in read-only transactions and the effect remains
after the transaction finished. Is it unacceptable behaviours, 
isn't it?

Also, when such transactions are used in recovery mode, it fails
but the messages output are not user friendly, like:

 postgres=# select lo_creat(42);
 ERROR:  cannot assign OIDs during recovery

 postgres=# select lo_create(42);
 ERROR:  cannot assign TransactionIds during recovery

 postgres=# select lo_unlink(16389);
 ERROR:  cannot acquire lock mode AccessExclusiveLock on database objects while recovery is in progress
 HINT:  Only RowExclusiveLock or less can be acquired on database objects during recovery.
 

So, I would like propose to explicitly prevent such writes operations
on large object in read-only transactions, like:

 postgres=# SELECT lo_create(42);
 ERROR:  cannot execute lo_create in a read-only transaction

The patch is attached.


Regards,
Yugo Nagata

-- 
Yugo NAGATA <nagata@sraoss.co.jp>

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: doc phrase: "inheritance child"
Следующее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: [BUG] Panic due to incorrect missingContrecPtr after promotion