apache / apache/age

Empty `UNWIND` followed by `MERGE` and a null-filtered `WITH` causes a PostgreSQL backend segmentation fault

Open
#2,534 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
4.8k
Forks
523
Avg merge
1d 2h
Merged PRs (30d)
9

Description

Docker image `apache/age:release_PG18_1.7.0

**Reproduction**

```sql
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT ag_catalog.create_graph('age_issue_case8_reduced');

SELECT *
FROM ag_catalog.cypher('age_issue_case8_reduced', $$
UNWIND [] AS x
MERGE (n)
WITH x, head(range(9, 23)) AS y
WHERE y IS NULL
RETURN {x: x, y: y} AS row
$$) AS (row agtype);
```

**Expected**

The empty input produces zero rows. The query completes normally, returns
zero rows, and does not create a vertex or terminate the PostgreSQL backend.

**Actual**

```text
server closed the connection unexpectedly
client backend ... was terminated by signal 11: Segmentation fault

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the segmentation fault with the apache/age:release_PG18_1.7.0 Docker image and the SQL query in the issue, using the LOAD, create_graph, and cypher entry points shown. Trace the empty UNWIND followed by MERGE and null-filtered WITH, then verify that it returns zero rows, creates no vertex, and does not terminate the PostgreSQL backend.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.