我试图在 AgensGraph 上获取数组标签?
但是,它返回关于类型转换的错误。
我怎样才能得到数组的标签?
agens=# match (n:o) with collect(n) as n return labels(n[0]);
ERROR: cannot cast type jsonb to vertex
agens =# match (n:o{id:1}) return labels(n);
labels
--------
["o"]
(1 row)
我试图在 AgensGraph 上获取数组标签?
但是,它返回关于类型转换的错误。
我怎样才能得到数组的标签?
agens=# match (n:o) with collect(n) as n return labels(n[0]);
ERROR: cannot cast type jsonb to vertex
agens =# match (n:o{id:1}) return labels(n);
labels
--------
["o"]
(1 row)
There is a problem on array processing of AgensGraph.
function "collect" converts all data-types to json.
And It is impossible to revert data-types.
agens =# match (n:o) with collect(n) as n return n[0];
n
--------------------------------------------------------
{"id": "3.1", "tid": "(0,1)", "properties": {"id": 1}}
(1 row)
agens =# match (n:o{id:1}) return n;
n
-----------------
o[3.1]{"id": 1}
(1 row)
Use "array_agg" instead of "collect".
agens =# match (n:o) with array_agg(n) as n return n[0];
n
-----------------
o[3.1]{"id": 1}
(1 row)
agens =# match (n:o) with array_agg(n) as n return labels(n[0]);
labels
--------
["o"]
(1 row)