我刚开始接触Postgres,使用的是v9.3版本,想要利用hstore
。
当我尝试连接两个hstore
值时,出现了一个奇怪的错误:
SELECT p.properties->'name' || p.properties->'age' FROM people p where p.id=1;
错误信息为:
ERROR: operator does not exist: text -> unknown
LINE 1: select n.properties->'name' || n.properties->'age' from n...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
我也尝试过这个方法,但并没有起到作用:
SELECT p.properties->'name'::text || p.properties->'age'::text FROM people p where p.id=1;
然而,我可以做到。
SELECT p.properties->'name' FROM people p where p.id=1;
SELECT p.properties->'age' FROM people p where p.id=1;
是否可以将两个来自同一个hstore的值连接起来?
非常感谢任何指导!