Skip to content

Negative indices on arrays seem to return nothing/null #240

Closed
@selendym

Description

Describe the bug
Negative indices on arrays seem to return nothing/null.

How are you accessing AGE (Command line, driver, etc.)?
With psql from the docker image. One container for the server and another one for the client.

What data setup do we need to do?

select * from ag_catalog.create_graph('g');

What is the necessary configuration info needed?
Just the docker image built from master branch.

What is the command that caused the error?

select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[-1] $$) as (r0 ag_catalog.agtype);

The above returns (note the empty line):

 r0 
----
 
(1 row)

Compare with:

select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[3] $$) as (r0 ag_catalog.agtype);
select * from ag_catalog.cypher('g', $$ with [0, 1, 2, 3] as l return l[-1..] $$) as (r0 ag_catalog.agtype);

which return:

 r0 
----
 3
(1 row)

and:

 r0  
-----
 [3]
(1 row)

Expected behavior
The negative index should work as described in: https://age.apache.org/docs/master/intro/types.html#negative-index-access

Environment (please complete the following information):

  • env: docker
  • branch: master
  • commit: 6fbdfa8

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions