wen-bing opened a new issue, #1983:
URL: https://github.com/apache/age/issues/1983

   **Describe the bug**
   cypher returned agtype cannot work with postgres IN clause
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   -PSQL
   
   **What data setup do we need to do?**
   ```pgsql
   
   1. create a graph and wtih a vertex label, like this(ignnore title and 
address fieldes)
   select * from ag_catalog.cypher('graph1', $$
    Match (v:Person)
    return v
   $$) as (v ag_catalog.agtype);
                                                                                
    v
   
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
    {"id": 844424930131969, "label": "Person", "properties": {"name": "AAA", 
"title": "Developer", "address": [{"country": "China"}, {"province": 
"ANHUI"}]}}::vertex
    {"id": 844424930131970, "label": "Person", "properties": {"name": "BBB", 
"title": "Designer", "address": [{"country": "USA"}, {"province": 
"Beijing"}]}}::vertex
    {"id": 844424930131971, "label": "Person", "properties": {"name": "CCC", 
"title": "Tester", "address": [{"country": "Japan"}, {"province": 
"shanghai"}]}}::vertex
   (3 rows)
   
   2. create a table with data like this:
   select * from table_person;
    name | age
   ------+-----
    AAA  |  12
    BBB  |  12
   (2 rows)
   
   3. use cypher under WITH clause
    
   with graph_query as (
   select * from ag_catalog.cypher('graph1', $$
    Match (v:Person)
    return v.name
   $$) as (name ag_catalog.agtype)
   )
   select t.name,t.age from table_person as t where t.name in (select * from 
graph_query);
   
   **ERROR:  operator does not exist: character varying = ag_catalog.agtype
   LINE 7: ... t.name,t.age from table_person as t where t.name in (select...
                                                                ^
   HINT:  No operator matches the given name and argument types. You might need 
to add explicit type casts.**
   -------------------------------------query 
2--------------------------------------------------------------
   select t.name, t.age from table_person as t where
   t.name in (
   select * from ag_catalog.cypher('graph1', $$
   Match(v:Person)
   return v.name
   $$) as (name ag_catalog.agtype));
   
   **ERROR:  operator does not exist: character varying = ag_catalog.agtype
   LINE 2: t.name in (
                  ^
   HINT:  No operator matches the given name and argument types. You might need 
to add explicit type casts.**
   
   5.  use cypher under WITH clause ,after cast agtype to varchar, nothing 
returned.
   with graph_query as (
   select * from ag_catalog.cypher('graph1', $$
    Match (v:Person)
    return v.name
   $$) as (name varchar(20))
   )
   select t.name,t.age from table_person as t where t.name in (select * from 
graph_query);
   
    name | age
   ------+-----
   (0 rows)
   
   ```
   
   **Expected behavior**
   **cypher return value can be used in postgres WITH clause**
   
   **Environment (please complete the following information):**
   - Version: 1.5.0
   - PG:16
   


-- 
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.apache.org

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

Reply via email to