Skip to content

If an alias is not specified, the count result is incorrect. #945

@beamrock

Description

@beamrock

Describe the bug
If an alias is not specified, the count result is incorrect.

How are you accessing AGE (Command line, driver, etc.)?

  • anywhere. I did in Command line.

What data setup do we need to do?

SELECT * from cypher('movie_graph', $$
CREATE (a:Part {part_num: '123'}), 
       (b:Part {part_num: '345'}), 
       (c:Part {part_num: '456'}), 
       (d:Part {part_num: '789'})
$$) as (a agtype);
moviedb=# SELECT * from cypher('movie_graph', $$ match (a:Part) return a $$) as (result agtype);
                                        result                                        
--------------------------------------------------------------------------------------
 {"id": 1125899906842625, "label": "Part", "properties": {"part_num": "123"}}::vertex
 {"id": 1125899906842626, "label": "Part", "properties": {"part_num": "345"}}::vertex
 {"id": 1125899906842627, "label": "Part", "properties": {"part_num": "456"}}::vertex
 {"id": 1125899906842628, "label": "Part", "properties": {"part_num": "789"}}::vertex
(4 rows)

What is the command that caused the error?

When an alias is not specified

moviedb=# SELECT * from cypher('movie_graph', $$ match (:Part) return count(*) $$) as (result agtype);   
 result 
--------
 1  <-------- incorrect count result
(1 row)

When an alias and a label is specified

moviedb=# SELECT * from cypher('movie_graph', $$ match (a:Part) return count(*) $$) as (result agtype); 
 result 
--------
 4
(1 row)

When only an alias is specified

moviedb=# SELECT * from cypher('movie_graph', $$ match (a) return count(*) $$) as (result agtype);     
 result 
--------
 4
(1 row)

Expected behavior

Same as agensgraph or neo4j

On Neo4j

neo4j@ldbcgraph> match (:Part) return count(*) ;
+----------+
| count(*) |
+----------+
| 4        |
+----------+

On AgensGraph

sampledb=# match (:Part) return count(*) ;
 count 
-------
 4

Additional context

Just so you know, agensgraph and neo4j give accurate results.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions