MironAtHome commented on issue #1933:
URL: https://github.com/apache/age/issues/1933#issuecomment-2212033441

   All you need is to wrap exists() into ag_catalog.agtype_to_bool() and 
declare output column as boolean.
   The way your query currently written it makes no sense, as if this "Node" 
has 1 vertice, than it would be just one "true" or "false", but if it has many, 
it will be a column of many true or false, without a way to discern which is 
which.
   You might want to modify query a bit to produce something like a key next to 
existance check.
   Here is example:
   
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   
   SELECT t.existscheck
   FROM cypher('test_graph', $$
       MATCH (n:Node)
       OPTIONAL MATCH (u)
       WITH ag_catalog.agtype_to_bool(exists((n)-[e:START]->(u))) AS 
existscheck, id(n)
       RETURN existscheck
   $$) as t(existscheck boolean);
   ---
   Please note, I have verified it using latest build off of branch PG16.
   Feel free to share version of Postgress and Apache Age to clarify, so that 
check matching version you are using can be provided.
   Please note, similar conversion functions are available to support various 
data types in PG16. Here is the list ( have extracted it from files under /sql 
subfolder of the github repository clone):
   
   Apache Age function  -> Postgres native data type
   ag_catalog.agtype_to_bool -> boolean
   ag_catalog.agtype_to_int2 -> smallint
   ag_catalog.agtype_to_int4 -> int
   ag_catalog.agtype_to_int8 -> bigint
   ag_catalog.agtype_to_float8 -> float8
   ag_catalog.agtype_to_text -> text
   ag_catalog.agtype_to_int4_array -> int[]
   
   Please see if you need any additional cast / convert functions and file as a 
request / feature enhancements.
   Hope it helps.
   --cheers


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to