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

 

最新文章

  1. POJ 1066 Treasure Hunt【线段相交】
  2. HDU 2204 Eddy&#39;s爱好(容斥原理)
  3. python matplotlib 绘图
  4. Spring Boot 快速入门
  5. Calendar Game
  6. 1003: A Bug
  7. 查询Sqlserver数据库死锁的一个存储过程(转)
  8. Java学习日记-11 集合(1)
  9. c++实现dll注入其它进程
  10. Python学习笔记1(基础语法)
  11. (原)Matlab的svmtrain和svmclassify
  12. Centos升级gcc4.4.7升级gcc4.8手记
  13. 调用一个系统命令,并读取它的输出值(使用QProcess.readAll)
  14. LINUX 笔记-iostat命令
  15. 1.由浅入深解析 SimpleDateFormat
  16. JDK源码分析-String、StringBuilder、StringBuffer
  17. MEF 基础简介 四
  18. MyCat配置运行
  19. EF对应null的处理
  20. 为什么Java匿名内部类访问的外部局部变量或参数需要被final修饰

热门文章

  1. 实验吧—Web——WP之 简单的sql注入之2
  2. Go Example--接口
  3. day11hadoop高可用和Hive
  4. jsp&amp;el&amp;jstl mvc和三层架构
  5. js中获取当前url参数值的一个方法
  6. Oracle12C版本安装步骤
  7. enum和数据库entity互转
  8. tomcat中catalina是什么
  9. IIS webService 并发 性能
  10. js this详解,事件的三种绑定方式