Skip to content

Server crashes when trying to execute SELECT * FROM cypher(...) #1302

@saygoodbyye

Description

@saygoodbyye

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 (PG15 branch) with PostgreSQL (REL_15_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('cypher_unwind');
SELECT * FROM cypher('cypher_unwind', $$
    CREATE (agtype {name: 'node1', a: [1, 2, 3]}),
           (m {name: 'node2', a: [4, 5, 6]}),
           (o {name: 'node3', a: [7, 8, 9]}),
           (n)-[:KNOWS]->(m),
           (m)-[:KNOWS]->(o)
$$) as (i agtype);
SELECT * FROM cypher('cypher_unwind', $$
    MATCH (n)
    WITH n.a AS a
    UNWIND a AS i
    RETURN *
$$) as (i agtype, j agtype);

backtrace:

#0  pg_detoast_datum (datum=0x0) at fmgr.c:1710
#1  0x00007f602f73878f in age_unnest (fcinfo=0x55c451aee4b0) at src/backend/utils/adt/agtype.c:10656
#2  0x000055c450a0893a in ExecMakeFunctionResultSet (fcache=0x55c451aed938, econtext=econtext@entry=0x55c451aecc58, argContext=0x55c451b392f0, isNull=0x55c451aed2f1, 
    isDone=isDone@entry=0x55c451aed35c) at execSRF.c:624
#3  0x000055c450a33e35 in ExecProjectSRF (node=node@entry=0x55c451aecb40, continuing=continuing@entry=false) at nodeProjectSet.c:175
#4  0x000055c450a33f4f in ExecProjectSet (pstate=<optimized out>) at nodeProjectSet.c:105
#5  0x000055c4509fd71a in ExecProcNode (node=node@entry=0x55c451aecb40) at ../../../src/include/executor/executor.h:262
#6  0x000055c4509fd7aa in ExecutePlan (estate=estate@entry=0x55c451aec8d0, planstate=0x55c451aecb40, use_parallel_mode=<optimized out>, operation=operation@entry=CMD_SELECT, 
    sendTuples=sendTuples@entry=true, numberTuples=numberTuples@entry=0, direction=ForwardScanDirection, dest=0x55c451b779e8, execute_once=true) at execMain.c:1636
#7  0x000055c4509fe569 in standard_ExecutorRun (queryDesc=0x55c451b4fc30, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:363
#8  0x000055c4509fe699 in ExecutorRun (queryDesc=queryDesc@entry=0x55c451b4fc30, direction=direction@entry=ForwardScanDirection, count=count@entry=0, execute_once=<optimized out>)
    at execMain.c:307
#9  0x000055c450ba5fdf in PortalRunSelect (portal=portal@entry=0x55c451a90380, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x55c451b779e8)
    at pquery.c:924
#10 0x000055c450ba7861 in PortalRun (portal=portal@entry=0x55c451a90380, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, 
    dest=dest@entry=0x55c451b779e8, altdest=altdest@entry=0x55c451b779e8, qc=0x7ffe78a311d0) at pquery.c:768
#11 0x000055c450ba39ed in exec_simple_query (
    query_string=query_string@entry=0x55c451a19970 "SELECT * FROM cypher('cypher_unwind', $$\n    MATCH (n)\n    WITH n.a AS a\n    UNWIND a AS i\n    RETURN *\n$$) as (i agtype, j agtype);") at postgres.c:1250
#12 0x000055c450ba5851 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#13 0x000055c450b0a832 in BackendRun (port=port@entry=0x55c451a40bf0) at postmaster.c:4514
#14 0x000055c450b0c842 in BackendStartup (port=port@entry=0x55c451a40bf0) at postmaster.c:4242
#15 0x000055c450b0ca7b in ServerLoop () at postmaster.c:1809
#16 0x000055c450b0e050 in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x55c451a10df0) at postmaster.c:1481
#17 0x000055c450a5adb8 in main (argc=3, argv=0x55c451a10df0) at main.c:202

Expected behavior
Expected ERROR to be shown or sql query to be succesfully executed

Also reproduces on AGE master branch

Best regards,
Egor Chindyaskin
Postgres Professional: http://postgrespro.com/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions