PG cannot execute UPDATE in a read-only transaction | How to add column if not exists on PostgreSQL
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>hasdefault_transaction_read_onlyset to ONthe database has
default_transaction_read_onlyset 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的更多相关文章
- Azkaban安装及分布式部署(multiple-executor)
参考文章:https://blog.csdn.net/weixin_35852328/article/details/79327996 官网:https://azkaban.readthedocs.i ...
- 常用 PostgreSQL 脚本
数据定义 数据库 -- 创建数据库 -- https://www.postgresql.org/docs/current/static/multibyte.html -- database_name, ...
- postgresql change table
--if cloumn exist SELECT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='ent' A ...
- 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 ...
- [转帖]postgres 创建新用户并授权-- 非常好的
postgres 创建新用户并授权 https://blog.csdn.net/XuHang666/article/details/81506297 原作者总结的挺好的 可以用来学习一下. grant ...
- PostGIS管网连通性分析
GIS在管网数据中的很重要的一个应用方向就是"管网空间分析",其中包括连通性分析.上下游分析.爆管分析等等.下面是我使用postgis来实现该"管网连通性分析" ...
- 【Spring】Spring的数据库开发 - 2、Spring JdbcTemplate的常用方法(execute、update、query)
Spring JdbcTemplate的常用方法 文章目录 Spring JdbcTemplate的常用方法 execute() update() query() 简单记录-Java EE企业级应用开 ...
- pt-online-schema-change中update触发器的bug
pt-online-schema-change在对表进行表结构变更时,会创建三个触发器. 如下文测试案例中的t2表,表结构如下: mysql> show create table t2\G . ...
- Delete,Update与LEFT Join
UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyB ...
随机推荐
- {python}完成完整的温度转换程序 猜数字游戏(猜价格,猜年龄等) 解析身份证号、学号不同片段的含义
完成完整的温度转换程序 while True: a = int(input("如果是华氏转摄氏,请按1\n,如果是摄氏转华氏,请按2\n")) if a==1: h = float ...
- OpenGL编程-OpenGL框架-win32项目
在win32项目中开发的程序 小知识: 控制台应用程序运行就是dos的界面 项目一般采用了可视化开发 开发出来的东西就像QQ之类的 是有窗口界面的 程序运行结果是这样的 源代码:对第45行进行覆盖 # ...
- CentOS7.1 KVM虚拟化之环境准备
备注:实验没有问题,只是暂时还不知道弄这个用来干嘛,不过先留着以后查看吧 一.基础平台 1.一台装有VMware的Windows系统 (可联网) 2.CentOS7.1 64bit 镜像 二.最小化安 ...
- C#中如何实现json转化时只处理部分属性
把对象转化为json字符串,很常用,但如果因为现在大部分项目都是用了ORM映射,导致一个对象的属性特别多,如果前台只需要部分属性如何实现? 当然最简单是所有属性都json化,前台只处理需要的属性,多余 ...
- HI3518E平台ISP调试环境搭建
海思的SDK提供了ISP调试的相关工具,降低了IPC的ISP调试的难度.初次搭建ISP调试环境,记录一下. SDK版本:Hi3518_MPP_V1.0.A.0 硬件平台:HI3518E_OV9732 ...
- jQuery 实现的瀑布流
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title> ...
- css 兼容性问题,整理
css 兼容性问题,整理: css 兼容性问题 说明 <input type="number"> 在chrome下,是不能输入非数字的字符的:但是在火狐63.0.3(2 ...
- Xshell配置SSH免密码登录
思路: 私钥存放于客户端,id_rsa 将客户端公钥存放于要远程控制服务器上:将客户在公钥id_rsa.pub内容追加到 /root/.ssh/authorized_keys 使用密钥认证分3步: 1 ...
- Jenkins 配置用户权限错误导致无法登录解决方案
最初配置Jenkins的用户管理权限时,因为不熟悉很容易将用户角色配置错误,导致配置用户后无法登录系统: 登录系统时候提示"Access Denied": 解决办法: 进入Jenk ...
- Jmeter关于断言
本文摘自:一颗糖果 https://www.cnblogs.com/linglingyuese/p/linglingyuese-five.html 1.断言持续时间(Duration to Ass ...