apache / apache/age

Deleting a matched relationship and then executing full-path `MERGE` causes a PostgreSQL backend segmentation fault

Open
#2,537 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_case11');

SELECT *
FROM ag_catalog.cypher('age_issue_case11', $$
CREATE (a:base {id: 1})-[r1:r {k0: false}]->
(n:base {id: 2})-[r0:s {k5: 'x'}]->(b:base {id: 3})
$$) AS (created agtype);

SELECT *
FROM ag_catalog.cypher('age_issue_case11', $$
MATCH (a:base)-[r1:r]->(n:base)-[r0:s]->(b:base)
SET r0.k5 = 'J', r1.k0 = true
WITH range(0, 0) + [0] AS keep, r1 AS old
WHERE 0 IN keep
DELETE old
CREATE (:x)
MERGE p0 = ({id: 129})-[r2:r]->(n2 {id: 130})-[:s]->(:c {id: 131})
RETURN 1
$$) AS (value agtype);
```

**Expected**

The query returns one row containing `1` and PostgreSQL remains available.

**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 with the apache/age:release_PG18_1.7.0 Docker image and run the SQL reproduction through ag_catalog.cypher, focusing on deleting the matched relationship before the full-path MERGE. Done means the query returns one row containing 1 and PostgreSQL remains available without a segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.