PG cannot execute UPDATE in a read-only transaction出现这种情况时,说明SQL语句可能是运行在一个PG集群中的非master节点上。查看data/pg_hba.conf。

  SELECT pg_is_in_recovery();

   This cannot return true in a master server because the only time a master server can be in recovery。

  还有如下可能Normally the most plausible reasons for this kind of error are :

  • trying create statements on a read-only replica (the entire instance is read-only).

  • <username> has default_transaction_read_only set to ON

  • the database has default_transaction_read_only set to ON

  alter database exercises set default_transaction_read_only = off;

https://stackoverflow.com/questions/31186414/error-cannot-execute-create-table-in-a-read-only-transaction

  How to add column if not exists on PostgreSQL

  With Postgres 9.6 this can be done using the option if not exists

  ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name INTEGER;

  https://stackoverflow.com/questions/12597465/how-to-add-column-if-not-exists-on-postgresql

 

PG cannot execute UPDATE in a read-only transaction | How to add column if not exists on PostgreSQL的更多相关文章

  1. Azkaban安装及分布式部署(multiple-executor)

    参考文章:https://blog.csdn.net/weixin_35852328/article/details/79327996 官网:https://azkaban.readthedocs.i ...

  2. 常用 PostgreSQL 脚本

    数据定义 数据库 -- 创建数据库 -- https://www.postgresql.org/docs/current/static/multibyte.html -- database_name, ...

  3. postgresql change table

    --if cloumn exist SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='ent' A ...

  4. Mysql官方文档中争对安全添加列的处理方法。Mysql Add a Column to a table if not exists

    Add a Column to a table if not exists MySQL allows you to create a table if it does not exist, but d ...

  5. [转帖]postgres 创建新用户并授权-- 非常好的

    postgres 创建新用户并授权 https://blog.csdn.net/XuHang666/article/details/81506297 原作者总结的挺好的 可以用来学习一下. grant ...

  6. PostGIS管网连通性分析

    GIS在管网数据中的很重要的一个应用方向就是"管网空间分析",其中包括连通性分析.上下游分析.爆管分析等等.下面是我使用postgis来实现该"管网连通性分析" ...

  7. 【Spring】Spring的数据库开发 - 2、Spring JdbcTemplate的常用方法(execute、update、query)

    Spring JdbcTemplate的常用方法 文章目录 Spring JdbcTemplate的常用方法 execute() update() query() 简单记录-Java EE企业级应用开 ...

  8. pt-online-schema-change中update触发器的bug

    pt-online-schema-change在对表进行表结构变更时,会创建三个触发器. 如下文测试案例中的t2表,表结构如下: mysql> show create table t2\G . ...

  9. Delete,Update与LEFT Join

    UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyB ...

随机推荐

  1. 20165313 《Java程序设计》第三周学习总结

    教材学习总结 这一章主要讲解了类的创建与使用,以及其中参数的调用方式,如何将多个对象组合,包的用法,访问权的设置和基本类封装. 1.对象注意初始化 2.包语句使用后要把对应得.java文件放到与包同名 ...

  2. Eclipse maven 错误修正方法:An error occurred while filtering resources

    最近打开Eclipse后发现项目报红叉,解决办法如下: 1.eclipse中删除该项目(注意:不要删除代码) 2.cmd,进入到项目目录下,执行命令:mvn eclipse:clean 3.重新导入项 ...

  3. HashMap<Integer, Bean> 根据Bean的属性进行排序

    转载地址 已知一个HashMap<Integer,User>集合, User有name(String)和age(int)属性.请写一个方法实现对HashMap的排序功能,该方法接收Hash ...

  4. doc 常用命令

    ★ 查看java环境变量 echo %JAVA_HOME% echo %PATH% echo %CLASSPATH%

  5. nodeJs项目 相关命令

    npm install -g cnpm --registry=https://registry.npm.taobao.org npm run dev

  6. URL编码规则

    一.问题的由来 问题:当url地址中包含&.+.%等特殊字符(主要是传递参数时,参数的内容中包含这些字符)时,地址无效.比如http://10.190.0.0:108/doc/test+des ...

  7. js判斷是否是正整數

    var curt_page = $("input[name='curt_page']").val(); if (!(/(^[1-9]\d*$)/.test(curt_page))) ...

  8. 大数据离线分析平台 JSSDK数据收集引擎编写

    JsSDK设计规则在js sdk中我们需要收集launch.pageview.chargeRequest和eventDuration四种数据,所以我们需要在js中写入四个方法来分别收集这些数据,另外我 ...

  9. 动态设置所有string字段不分词

    PUT     http://192.168.1.12:9200/test { "settings": { "number_of_shards": 3, &qu ...

  10. Github访问慢解决办法

    为什么慢?github的CDN被某墙屏了. 绕过dns解析,在本地直接绑定host.打开dns查询工具网站http://tool.chinaz.com/dns 查询域名github.global.ss ...