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. NDK: GCC 4.6 crashes

    used version: NDK r9b, arm-linux-androideabi-4.6 GCC,  with "-O2 -finline-limit=24". got t ...

  2. nginx实现集群高可用

    大家知道NGINX作为反向代理服务器可以实现负载均衡,同时也可以作为静态文件服务器,它的特点就是并发支持大,单机可同时支持3万并发,现在很多网站都把NGINX作为网关入口来统一调度分配后端资源.但是如 ...

  3. Modern Data Lake with Minio : Part 1

    转自:https://blog.minio.io/modern-data-lake-with-minio-part-1-716a49499533 Modern data lakes are now b ...

  4. 机器学习 - 开发环境安装pycharm + tensorflow集成篇

    继续上篇的pyspark集成后,我们再来看看当今热的不得了的tensorflow是如何继承进pycharm环境的 参考: http://blog.csdn.net/include1224/articl ...

  5. trac

    F:\Python27>python F:\portabletrac\ez_setup.pyDownloading https://pypi.io/packages/source/s/setup ...

  6. Chrome 66 禁止声音自动播放

    声音无法自动播放一直在IOS/Android上面都是一个惯例, 桌面端的 Safari在2017年的11版本中也宣布禁止带有声音的多媒体自动播放, 紧接着2018年4月份Chrome发布的66版本也正 ...

  7. TypeScript 之 声明文件的结构

    https://www.tslang.cn/docs/handbook/declaration-files/library-structures.html 模块化库 一些库只能工作在模块加载器的环境下 ...

  8. highcharts 知识点

    去掉版权: credits:{ enabled:true // 默认值,如果想去掉版权信息,设置为false即可 }

  9. C# MD5位加密

    /// <summary> /// 方法一:通过使用 new 运算符创建对象 /// </summary> /// <param name="strSource ...

  10. 概率p输出1,概率1-p输出0,等概率输出0和1

    有个输出0和1的BIASED RANDOM,它以概率p输出1,以概率1-p输出0,以此RANDOM函数为基础,生成另一个RANDOM函数,该函数以1/2的概率输出1,以1/2的概率输出0 题目解答: ...