PostgreSQL hstore连接
根据TFM(),您可以使用普通连接运算符连接两个hstore:PostgreSQL hstore连接,postgresql,hstore,Postgresql,Hstore,根据TFM(),您可以使用普通连接运算符连接两个hstore: SELECT 'a=>b, c=>d'::hstore || 'c=>x, d=>q'::hstore 结果: "a"=>"b", "c"=>"x", "d"=>"q" 但是,在运行完全相同的命令时,我遇到了一个错误: [42883] ERROR: operator does not exist: hstore || hstore Hint: No operator matches th
SELECT 'a=>b, c=>d'::hstore || 'c=>x, d=>q'::hstore
结果:
"a"=>"b", "c"=>"x", "d"=>"q"
但是,在运行完全相同的命令时,我遇到了一个错误:
[42883] ERROR: operator does not exist: hstore || hstore Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
我能得到想要的结果的唯一方法是做一些让我想哭的骇人听闻的事情:首先将我所有的商店转换成文本,然后连接文本并转换回一个商店。当然,这是不好的,因为文档还声明,如果存在重复的密钥,则无法保证哪一个密钥会在连接后存活
在我向Postgres的人提交bug之前,其他人能复制这个吗?版本信息:
select version();
PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit
select extname,extversion from pg_catalog.pg_extension;
hstore 1.3
解决了这个问题。HSTORE扩展被安装到一个单独的模式中;我可以通过识别它来调用该模式(sys.hstore),但它仍然不喜欢运算符| |。修复方法其实很简单:我将sys添加到搜索路径。在9.4.2到9.5beta2(2个vc++win,3个gcc ubuntu,全部64位)的5台服务器上正常工作。klin,你在所有服务器上都使用hstore 1.3吗?是的,hstore 1.3。