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中连接两个hstore值吗?
任何指导者都会感激的!
发布于 2015-03-11 04:20:48
您可以按照如下方式处理强制转换函数:
SELECT CAST(p.properties->'name' AS text) || CAST(p.properties->'age' AS text) FROM people p where p.id=1;https://stackoverflow.com/questions/28977940
复制相似问题