![](https://img-blog.csdnimg.cn/20200408202653648.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
postgresql
文章平均质量分 66
postgresql
单调枯燥的CC
Stay Hungry, Stay Foolish
展开
-
ERROR: canceling statement due to conflict with recovery
ERROR: canceling statement due to conflict with recovery报错现象ERROR: canceling statement due to conflict with recoveryDETAIL: User query might have needed to see row versions that must be removed.业务重现系统采用postgresql主备库数据库架构,主库用在微信小程序主要用在业务中产生的数据写入从库采用原创 2021-02-24 10:52:23 · 4338 阅读 · 0 评论 -
值得收藏的好文——postgresql 增加约束、删除约束、增加列、删除列
值得收藏的好文——postgresql 增加约束、删除约束、增加列、删除列原创 2020-04-09 00:17:40 · 7260 阅读 · 16 评论 -
postgresql中::的使用
::的使用说明例子1:select '123'::NUMERIC as number;结果1:例子2:select '123' as number; 对比看出:例子1是数字的123,例子2是文本的123。::作用:将一种类型的常量转化成指定类型的常量例子1等价于以下两种写法select cast('123' as NUMERIC);select NUMERIC'1...原创 2020-04-08 21:48:47 · 2434 阅读 · 0 评论 -
postgresql case when then else end的用法
case when用法基本语法:select case A when B then C else D end E from tableA可以为表中的字段名或者是子查询,总之A是一个表达式B是表达式的结果,如果A的查询结果等于B,则结果是C,否则是DE是结果的查询别名,自己定义从表中取zpid,zhid(别名 zt)if(zhid=='CS1'){zt='1'} else if...原创 2019-12-13 16:46:13 · 16155 阅读 · 1 评论 -
postgresql 从一段时间内获取最早的一天或者最晚的一天
方法1select * from 表 where openid='****' order by (fwsj - to_timestamp(to_char(fwsj,'YYYY-MM-DD'),'YYYY-MM-DD')) limit 1;取最早时间 倒序排序取最晚时间方法2:select * from 表 where openid='***' order by (extract(...原创 2019-09-29 14:11:27 · 2582 阅读 · 0 评论 -
sql中join的用法
select * from table1 ;-- BETWEEN 用法select * from table1 where kssj BETWEEN '2019-05-01' and '2019-05-01';select * from table1 where kssj >= '2019-05-01' and kssj<= '2019-05-01';-- join用法se...原创 2019-05-22 11:05:24 · 849 阅读 · 0 评论 -
postgresql 一些SQL使用技巧
|| 实现sql的字符串的连接sql实现手机号脱敏sql使用正则表达式替换掉查询中的指定文字sql按照时间段显示一段时间的访问量sql将日期转为时间戳,用来比较时间大小时间戳转日期to_date(text,text)说明原创 2020-03-07 17:01:01 · 1083 阅读 · 0 评论