Repository navigation
Closed
Labels
Description
Describe the bug
Server crashes when executing the following SQL-script
How are you accessing AGE (Command line, driver, etc.)?
Accessing AGE through command line.
What data setup do we need to do?
Apache AGE (PG16 branch) with PostgreSQL (REL_16_STABLE).
What is the necessary configuration info needed?
My PostgreSQL configuration:
./configure CFLAGS=" -Og" --enable-tap-tests --enable-debug --enable-cassert
What is the command that caused the error?
CREATE EXTENSION age;
SET search_path TO ag_catalog;
SELECT create_graph('list_comprehension');
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u) AS v RETURN v $$) AS (u agtype);
SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) WITh u, collect(u.list) AS v SET u += {b: [u IN range(0, 5)]} SET u.c = [u IN v[0]] RETURN u $$) AS (u agtype);backtrace:
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140110869255104) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140110869255104) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140110869255104, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007f6e1c824476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007f6e1c80a7f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000056309a7a4c24 in ExceptionalCondition (conditionName=conditionName@entry=0x56309a8fb478 "attnum >= 0 && attnum < outerslot->tts_nvalid", fileName=fileName@entry=0x56309a8fab27 "execExprInterp.c", lineNumber=lineNumber@entry=582) at assert.c:66
#6 0x000056309a46d4c1 in ExecInterpExpr (state=0x56309c452ce0, econtext=0x56309c451d70, isnull=0x7fffc5c16027) at execExprInterp.c:582
#7 0x000056309a469cae in ExecInterpExprStillValid (state=0x56309c452ce0, econtext=0x56309c451d70, isNull=0x7fffc5c16027) at execExprInterp.c:1870
#8 0x000056309a488e49 in ExecEvalExprSwitchContext (isNull=0x7fffc5c16027, econtext=0x56309c451d70, state=0x56309c452ce0) at ../../../src/include/executor/executor.h:355
#9 ExecProject (projInfo=0x56309c452cd8) at ../../../src/include/executor/executor.h:389
#10 project_aggregates (aggstate=aggstate@entry=0x56309c4518b8) at nodeAgg.c:1385
#11 0x000056309a489932 in agg_retrieve_direct (aggstate=aggstate@entry=0x56309c4518b8) at nodeAgg.c:2528
#12 0x000056309a489d72 in ExecAgg (pstate=0x56309c4518b8) at nodeAgg.c:2180
#13 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c4518b8) at execProcnode.c:464
#14 0x000056309a4afa95 in ExecProcNode (node=0x56309c4518b8) at ../../../src/include/executor/executor.h:273
#15 SubqueryNext (node=<optimized out>) at nodeSubqueryscan.c:53
#16 0x000056309a47dbd3 in ExecScanFetch (node=node@entry=0x56309c3da588, accessMtd=accessMtd@entry=0x56309a4afa74 <SubqueryNext>, recheckMtd=recheckMtd@entry=0x56309a4afa25 <SubqueryRecheck>) at execScan.c:132
#17 0x000056309a47dd64 in ExecScan (node=0x56309c3da588, accessMtd=accessMtd@entry=0x56309a4afa74 <SubqueryNext>, recheckMtd=recheckMtd@entry=0x56309a4afa25 <SubqueryRecheck>) at execScan.c:198
#18 0x000056309a4afa57 in ExecSubqueryScan (pstate=<optimized out>) at nodeSubqueryscan.c:87
#19 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3da588) at execProcnode.c:464
#20 0x00007f6e1a60e614 in ExecProcNode (node=0x56309c3da588) at /tmp/pgsql/include/server/executor/executor.h:273
#21 exec_cypher_set (node=0x56309c3d9df8) at src/backend/executor/cypher_set.c:614
#22 0x000056309a48f4b4 in ExecCustomScan (pstate=0x56309c3d9df8) at nodeCustom.c:124
#23 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3d9df8) at execProcnode.c:464
#24 0x000056309a4aa1b4 in ExecProcNode (node=0x56309c3d9df8) at ../../../src/include/executor/executor.h:273
#25 ExecNestLoop (pstate=0x56309c3d9bc8) at nodeNestloop.c:109
#26 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3d9bc8) at execProcnode.c:464
#27 0x000056309a4861df in ExecProcNode (node=0x56309c3d9bc8) at ../../../src/include/executor/executor.h:273
#28 fetch_input_tuple (aggstate=aggstate@entry=0x56309c3d95f0) at nodeAgg.c:562
#29 0x000056309a489a9b in agg_retrieve_direct (aggstate=aggstate@entry=0x56309c3d95f0) at nodeAgg.c:2365
#30 0x000056309a489d72 in ExecAgg (pstate=0x56309c3d95f0) at nodeAgg.c:2180
#31 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3d95f0) at execProcnode.c:464
#32 0x000056309a4afa95 in ExecProcNode (node=0x56309c3d95f0) at ../../../src/include/executor/executor.h:273
#33 SubqueryNext (node=<optimized out>) at nodeSubqueryscan.c:53
#34 0x000056309a47dbd3 in ExecScanFetch (node=node@entry=0x56309c3d9450, accessMtd=accessMtd@entry=0x56309a4afa74 <SubqueryNext>, recheckMtd=recheckMtd@entry=0x56309a4afa25 <SubqueryRecheck>) at execScan.c:132
#35 0x000056309a47dd64 in ExecScan (node=0x56309c3d9450, accessMtd=accessMtd@entry=0x56309a4afa74 <SubqueryNext>, recheckMtd=recheckMtd@entry=0x56309a4afa25 <SubqueryRecheck>) at execScan.c:198
#36 0x000056309a4afa57 in ExecSubqueryScan (pstate=<optimized out>) at nodeSubqueryscan.c:87
#37 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3d9450) at execProcnode.c:464
#38 0x00007f6e1a60e614 in ExecProcNode (node=0x56309c3d9450) at /tmp/pgsql/include/server/executor/executor.h:273
#39 exec_cypher_set (node=0x56309c3d8c08) at src/backend/executor/cypher_set.c:614
#40 0x000056309a48f4b4 in ExecCustomScan (pstate=0x56309c3d8c08) at nodeCustom.c:124
#41 0x000056309a47a94b in ExecProcNodeFirst (node=0x56309c3d8c08) at execProcnode.c:464
#42 0x000056309a472f0e in ExecProcNode (node=0x56309c3d8c08) at ../../../src/include/executor/executor.h:273
#43 ExecutePlan (estate=estate@entry=0x56309c3d8918, planstate=0x56309c3d8c08, use_parallel_mode=<optimized out>, operation=operation@entry=CMD_SELECT, sendTuples=sendTuples@entry=true, numberTuples=numberTuples@entry=0, direction=ForwardScanDirection, dest=0x56309c483790, execute_once=true) at execMain.c:1670
#44 0x000056309a4730d1 in standard_ExecutorRun (queryDesc=0x56309c448bc8, direction=ForwardScanDirection, count=0, execute_once=<optimized out>) at execMain.c:365
#45 0x000056309a4731ab in ExecutorRun (queryDesc=queryDesc@entry=0x56309c448bc8, direction=direction@entry=ForwardScanDirection, count=count@entry=0, execute_once=<optimized out>) at execMain.c:309
#46 0x000056309a65a436 in PortalRunSelect (portal=portal@entry=0x56309c379008, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x56309c483790) at pquery.c:924
#47 0x000056309a65bdd7 in PortalRun (portal=portal@entry=0x56309c379008, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x56309c483790, altdest=altdest@entry=0x56309c483790, qc=0x7fffc5c167a0) at pquery.c:768
#48 0x000056309a657eee in exec_simple_query (query_string=query_string@entry=0x56309c2fb618 "SELECT * FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) WITh u, collect(u.list) AS v SET u += {b: [u IN range(0, 5)]} SET u.c = [u IN v[0]] RETURN u $$) AS (u agtype);") at postgres.c:1274
#49 0x000056309a659d6f in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4637
#50 0x000056309a5b1011 in BackendRun (port=port@entry=0x56309c32f180) at postmaster.c:4464
#51 0x000056309a5b40c8 in BackendStartup (port=port@entry=0x56309c32f180) at postmaster.c:4192
#52 0x000056309a5b4266 in ServerLoop () at postmaster.c:1782
#53 0x000056309a5b5777 in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x56309c2f5b90) at postmaster.c:1466
#54 0x000056309a4d2b93 in main (argc=3, argv=0x56309c2f5b90) at main.c:198Expected behavior:
Expected ERROR to be shown or sql query to be succesfully executed
Best regards,
Egor Chindyaskin
Postgres Professional: https://postgrespro.com/
Activity
jrgemignani commentedon May 8, 2024
@MuhammadTahaNaveed
saygoodbyye commentedon May 10, 2024
@MuhammadTahaNaveed, hello! One more crash on postgres REL_16_STABLE and Age PG16 on build without cassert.
test.sql:
backtrace:
MuhammadTahaNaveed commentedon May 10, 2024
hello @saygoodbyye
The issue is with the query that you have already reported before i.e.
The following query is expected to return error and it does
I am working on a fix for the bug that you reported. I will update you as soon as I have an update or a fix.
Update cypher_set.sql
diangamichael commentedon May 14, 2024
I think you should breakdown your complex query into simple blocks then execute one by one to isolate the error within the query
-- Create the extension and graph
CREATE EXTENSION age;
SET search_path TO ag_catalog;
SELECT create_graph('list_comprehension');
-- Test simpler Cypher queries
-- Step 1: Simple list comprehension
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u RETURN u $$) AS (u agtype);
-- Step 2: Unwind a list
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND u AS v RETURN v $$) AS (v agtype);
If the simplified queries work increase the complexities step by step
-- Step 3: Collect a list
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND u AS v RETURN collect(v) $$) AS (collected agtype);
-- Step 4: Add matching and setting properties
SELECT * FROM cypher('list_comprehension', $$ CREATE (n {list: [0, 2, 4, 6, 8, 10, 12]}) RETURN n $$) AS (n agtype);
SELECT * FROM cypher('list_comprehension', $$ MATCH (n {list: [0, 2, 4, 6, 8, 10, 12]}) RETURN n $$) AS (n agtype);
SELECT * FROM cypher('list_comprehension', $$ MATCH (n {list: [0, 2, 4, 6, 8, 10, 12]}) WITH n, collect(n.list) AS v RETURN v $$) AS (v agtype);
with this you isolate the problematic query and rectify it
github-actions commentedon Jul 14, 2024
This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days.