age: Property access from edge/vertex in array gives unexpected error

Describe the bug Property access from edge/vertex in array gives unexpected error.

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

  • terminal

What data setup do we need to do?

SELECT * FROM cypher('graph',$$
    CREATE (n)-[:KNOWS {n:'hello'}]->({n:'hello'})
$$) as (a agtype);

What is the command that caused the error?

SELECT * FROM cypher('graph',$$
    MATCH ()<-[x *]-()
    RETURN x[0].n
$$) as (a agtype);
ERROR:  container must be an array or object

Expected behavior should have executed successfully and returned hello

Environment (please complete the following information):

  • 1.3.0 PG12

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@MuhammadTahaNaveed Yeah, we kind of both came up with a solution and PR at the same time. We need to coordinate better, lol.

It looks like this is a special case and maybe the access operator needs to be adjusted. Or, what is stored needs to be. I’m just not sure which, yet.

@jrgemignani oh okay! Actually I tried a fix for it in pr #1034. Can you give a look ? Thanks.

The regular match uses _agtype_build_edge. The vle match uses agtype_value_build_edge. Both convert their contents to agtype, but differently.

I think it might be the difference between a serialized array of agtypes versus and array of agtype_values.

I’m looking at it in the debugger. Apparently, the regular match and vle match go through different routes - each creates the edge in a different way.

What would be the output if you do RETURN x?

An array of edges.