加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL's read only transaction mode

发布时间:2020-12-13 17:14:35 所属栏目:百科 来源:网络整理
导读:在只读模式下,PostgreSQL不允许如下SQL: When a transaction is read-only,the following SQL commands are disallowed: INSERT , UPDATE DELETE COPY FROM if the table they would write to is not a temporary table; all CREATE ALTER DROP commands; CO
在只读模式下,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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读