小编Kub*_*uba的帖子

将 hstore 条目添加到未初始化 (NULL) 列

我最近被这个“功能”咬了。

如果您的hstore列未初始化并且您开始向其中添加条目,则它们都会被无声地吞下而不会出错。

这是预期的吗?

 create table test_hstore(id int, map hstore);
 insert into test_hstore(id,map) values(0, '');
 INSERT 0 1

 select * from test_hstore ;
  id | map 
 ----+-----
   0 | 


 update test_hstore set map = map || hstore('key1', 'value1') where id = 0;
 UPDATE 1

 select * from test_hstore;
  id |       map        
 ----+------------------
   0 | "key1"=>"value1"


 update test_hstore set map = null where id = 0;
 UPDATE 1

 select * from test_hstore;
  id |  map   
 ----+--------
   0 | (null)


 update …
Run Code Online (Sandbox Code Playgroud)

postgresql null update hstore

4
推荐指数
2
解决办法
2306
查看次数

.psqlrc - 设置 keepalives_idle 连接参数

是否可以设置keepalives_idle参数.psqlrc以便我打开的每个连接都使用它?

我终于找到了这个选项,它是我的连接断开问题的补救措施。

我真的很想为我打开的所有会话全局设置它psql

postgresql psql

1
推荐指数
1
解决办法
3091
查看次数

标签 统计

postgresql ×2

hstore ×1

null ×1

psql ×1

update ×1