Postgresql 从hstore中删除密钥时出现意外的字符串结尾

Postgresql 从hstore中删除密钥时出现意外的字符串结尾,postgresql,casting,hstore,Postgresql,Casting,Hstore,从HSTORE中删除密钥时,出现错误“字符串意外结束”: DB=# UPDATE mytable SET properties = properties - 'key' where label = '9912345678'; ERROR: Unexpected end of string LINE 1: UPDATE mytable SET properties = properties - 'key' where ... 当我显式转换该字符串时,它确实起作用: DB=# UPDATE

从HSTORE中删除密钥时,出现错误“字符串意外结束”:

DB=# UPDATE mytable SET properties = properties - 'key'  where label = '9912345678';
ERROR:  Unexpected end of string
LINE 1: UPDATE mytable SET properties = properties - 'key'  where ...
当我显式转换该字符串时,它确实起作用:

DB=# UPDATE mytable SET properties = properties - 'key'::text  where label = '9912345678';
UPDATE 1

为什么它会给出这个错误消息?
不是一个
文本
列吗?或者至少是一个具有预期结尾的字符串?

运算符重载,因此应该显式转换右侧操作数。请注意中
text
text[]
hstore
的示例用法

在声明中

UPDATE mytable SET properties = properties - 'key' where label = '9912345678';
字符串
'key'
可以解析为
文本
存储
。hstore算法的第一个选择是
hstore
,因此该语句被解析为

UPDATE mytable SET properties = properties - 'key'::hstore where label = '9912345678';
并提出了错误

ERROR:  Unexpected end of string

尽管错误消息可能更具信息性,例如解析hstore常量时出现的
意外字符串结尾。

谢谢。你有更多的关于你的话的信息吗?>运算符超载,所以右操作数应该明确地投下。< /代码>?考虑{{a,b}’中的歧义-是一个单键还是一个两个数组?@巴特弗里德里希斯-操作符是不明确的,我在这个例子中添加了操作数是如何解决的。
ERROR:  Unexpected end of string