| From: | zengman <zengman(at)halodbtech(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, assam258 <assam258(at)gmail(dot)com> |
| Cc: | Amit Langote <amitlangote09(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Ajay Pal <ajay(dot)pal(dot)k(at)gmail(dot)com>, Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: SQL Property Graph Queries (SQL/PGQ) |
| Date: | 2026-03-18 06:31:03 |
| Message-ID: | tencent_0F596C3C557454CE7EC420B4@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
I hit a Segmentation fault due to what might be an non-standard coding approach I used. Here are the test details and error logs:
```
postgres(at)zxm-VMware-Virtual-Platform:~/code/postgres$ psql
psql (19devel)
Type "help" for help.
postgres=# CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(50)
);
CREATE TABLE follows (
id INT PRIMARY KEY,
follower INT REFERENCES users(id),
following INT REFERENCES users(id)
);
INSERT INTO users VALUES
(1, 'A'), (2, 'B'), (3, 'C'), (4, 'D');
INSERT INTO follows VALUES
(1, 1, 2),
(2, 1, 3),
(3, 2, 3),
(4, 2, 4),
(5, 3, 4);
CREATE PROPERTY GRAPH social_graph
VERTEX TABLES (users)
EDGE TABLES (
follows
SOURCE KEY (follower) REFERENCES users(id)
DESTINATION KEY (following) REFERENCES users(id)
);
-- ok
SELECT *
FROM GRAPH_TABLE (
social_graph
MATCH (a IS users)-[]->(x IS users)<-[]-(b IS users)
WHERE b.name != a.name
COLUMNS (a.name AS usera, x.name AS common_name, b.name AS userb)
);
-- error
SELECT *
FROM GRAPH_TABLE (
social_graph
MATCH (a IS users)-[]->(x IS users)<-[]-(b IS users WHERE b.name != a.name)
COLUMNS (a.name AS usera, x.name AS common_name, b.name AS userb)
);
CREATE TABLE
CREATE TABLE
INSERT 0 4
INSERT 0 5
CREATE PROPERTY GRAPH
usera | common_name | userb
-------+-------------+-------
A | C | B
B | C | A
B | D | C
C | D | B
(4 rows)
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: 2026-03-18 14:09:29.522 CST [103556] LOG: client backend (PID 103851) was terminated by signal 11: Segmentation fault
2026-03-18 14:09:29.522 CST [103556] DETAIL: Failed process was running: SELECT *
FROM GRAPH_TABLE (
social_graph
MATCH (a IS users)-[]->(x IS users)<-[]-(b IS users WHERE b.name != a.name)
COLUMNS (a.name AS usera, x.name AS common_name, b.name AS userb)
);
2026-03-18 14:09:29.522 CST [103556] LOG: terminating any other active server processes
Failed.
The connection to the server was lost. Attempting reset: Failed.
2026-03-18 14:09:29.524 CST [103556] LOG: all server processes terminated; reinitializing
!?> 2026-03-18 14:09:29.546 CST [103857] LOG: database system was interrupted; last known up at 2026-03-18 14:08:06 CST
2026-03-18 14:09:29.570 CST [103857] LOG: database system was not properly shut down; automatic recovery in progress
2026-03-18 14:09:29.572 CST [103857] LOG: redo starts at 0/02487AE8
2026-03-18 14:09:29.578 CST [103857] LOG: invalid record length at 0/024E0AB0: expected at least 24, got 0
2026-03-18 14:09:29.578 CST [103857] LOG: redo done at 0/024E07A8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2026-03-18 14:09:29.596 CST [103556] LOG: database system is ready to accept connections
```
I checked the code and found that `found_mapping` was a null pointer because I didn’t enable assertions. The code in question is in `src/backend/rewrite/rewriteGraphTable.c`:
```
/*
* transformGraphTablePropertyRef() would not create a
* GraphPropertyRef for a variable which is not present in the graph
* path pattern.
*/
Assert(found_mapping);
mapping_factor = found_mapping->path_factor;
```
Should we remove this assertion and throw an error message instead to handle this case?
--
regards,
Man Zeng
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-03-18 06:31:23 | Re: Release postmaster working memory context in slotsync worker |
| Previous Message | Masahiko Sawada | 2026-03-18 06:20:34 | Re: Skipping schema changes in publication |