zihaozeng0021 opened a new issue, #2623:
URL: https://github.com/apache/age/issues/2623
# Property access on a list value raises XX000 "array index must resolve to
an integer value"
### Configuration
Docker Image: `apache/age:release_PG18_1.8.0`
Image Digest:
`sha256:47a0b054c3663a3e64a25fc0c5a982f1b58348019274b326a691cdf77f78eb58`
PostgreSQL Version: `18.6`
Apache AGE Extension Version: `1.8.0`
Operating System: WSL2, Ubuntu 24.04.1 LTS
Installation Method: Docker
Query Interface: `psql` (`SELECT * FROM cypher('xgdb', $$ ... $$) AS (...)`)
---
### Description
Property access applied directly to a list value - `e.id` where `e` is a
variable-length relationship alias, or `[{a: 1}].a` on a plain map list -
compiles into AGE's
array-access operator, and the string property index reaches the runtime,
which raises the
internal error `XX000: array index must resolve to an integer value`
(`execute_array_access_operator`, `agtype.c:3947`). The statement aborts
instead of returning a
clean Cypher type error or a projected list.
---
### Steps to reproduce
1. Start the AGE container and connect with `psql`.
2. On an empty graph run the pure expression form:
```sql
SELECT ag_catalog.create_graph('xgdb');
SELECT * FROM cypher('xgdb', $$ RETURN [{a: 1}].a $$) AS (dot_list agtype);
```
3. A fuller shape fails at the same place. With `A {x: 1}`, edge `E {id:
1}`, and
edges `F`/`C` present:
```sql
SELECT * FROM cypher('xgdb', $$ MATCH (:A {x: 1})-[e:E*0..1]->()-[f:F]->(:C)
WHERE e.id + f.id > 0 RETURN 1 $$) AS (d1 agtype);
```
---
### Expected behaviour
Cypher property access is defined on map, node, and relationship base
values. On a list base the
engine must return a clean, user-facing type error (Neo4j reports
`22N27 invalid entity type LIST<...>`), or - if list projection is intended
- return the
projected list of values. An internal `XX000` runtime error is never an
acceptable outcome.
---
### Actual behaviour
Both fresh-container runs abort:
```text
ERROR: array index must resolve to an integer value
REPRO2A_EXIT=3
```
With `\set VERBOSITY verbose`, both the issue shape and the pure expression
abort identically:
```text
ERROR: XX000: array index must resolve to an integer value
LOCATION: execute_array_access_operator, agtype.c:3947
```
Controls on the same engine succeed: fixed-edge alias property access `f.id`
(D4) and subscript
`e[0].id` forms work; only the dot form on a list base fails. Backend alive,
`RestartCount=0`, no FATAL/PANIC in the server log.
---
### Minimal reproduction
```sql
SELECT * FROM cypher('xgdb', $$ RETURN [{a: 1}].a $$) AS (dot_list agtype);
```
Empty graph; no data required.
---
### Why this appears to be a bug
The property-access operator is mapped onto an array-access operator that
cannot handle string
indices, so a semantically invalid-but-expressible query aborts the backend
with an internal
error rather than being rejected with a proper Cypher type error. Internal
errors on user queries
hide the real cause from users and abort the whole statement instead of the
single expression.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]