PostgreSQL's read only transaction mode

前端之家收集整理的这篇文章主要介绍了PostgreSQL's read only transaction mode前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在只读模式下,Postgresql不允许如下sql:

When a transaction is read-only,the following sql commands are disallowed:INSERT,UPDATEDELETECOPY FROMif the table they would write to is not a temporary table; allCREATEALTERDROPcommands;COMMENTGRANTREVOKETRUNCATE; andEXPLAIN ANALYZEandEXECUTEif the command they would execute is among those listed. This is a high-level notion of read-only that does not prevent all writes to disk.


mydb=# begin;
BEGIN
mydb=# set transaction read only;
SET

--插入数据失败 mydb=# insert into t values(generate_series(1,10000),'rudy'); ERROR: cannot execute INSERT in a read-only transaction

原文链接:https://www.f2er.com/postgresql/194968.html

猜你在找的Postgre SQL相关文章