Repository navigation
Closed
Labels
bugSomething isn't working
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 (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/
Reacted by John Gemignani
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Fix issue apache#1302 - crash on NULL input to UNWIND
MuhammadTahaNaveed commentedon Oct 26, 2023
PR #1304 resolves this issue.
theaniketraj commentedon Oct 26, 2023
The backtrace and description you provided indicate that there is a bug in the execution of a SQL script involving the AGE (ArangoDB Graph Engine) extension for PostgreSQL. Specifically, the crash occurs during the execution of a query that involves the cypher function. The relevant part of the backtrace suggests that the crash occurs when trying to process data using the age_unnest function in the agtype.c source file.
To address this issue, you might consider the following steps:
Check Configuration and Versions:
Ensure that you are using compatible versions of AGE, PostgreSQL, and the AGE extension. Some crashes can occur due to version incompatibilities.
Review the SQL Script:
Carefully review the SQL script to identify any potential issues with the query or the data being processed. Pay attention to the specific usage of the cypher function and the age_unnest function.
Check for Known Issues:
Search for any known issues or bug reports related to AGE, PostgreSQL, or the AGE extension. Other users may have encountered and reported similar problems.
Debugging:
If you have access to the source code of AGE or the AGE extension, consider using debugging tools to trace the issue. The crash occurs during the execution of the age_unnest function, so that function might be a good place to start your debugging.
Testing Environment:
Ensure that you are testing in a clean and well-configured environment to rule out issues related to the development or testing setup.
Database State:
Examine the state of your database and ensure that it is consistent. Database corruption or other anomalies can lead to unexpected crashes.
Engage the Community:
If you are unable to resolve the issue on your own, consider engaging with the AGE or PostgreSQL community or support channels. They may be able to provide guidance or assistance.
Update or Patch:
Check if there are any updates, patches, or fixes available for the version of AGE and the AGE extension you are using. Applying updates can often address known issues.
Regression Testing:
If you have made any code changes or configuration modifications, perform regression testing to ensure that the issue is not introduced by your own changes.
MuhammadTahaNaveed commentedon Oct 26, 2023
@theaniketraj please don't use chatgpt and spam issues.
Fix issue #1302 - crash on NULL input to UNWIND (#1304)
Fix issue apache#1302 - crash on NULL input to UNWIND (apache#1304)
Fix issue #1302 - crash on NULL input to UNWIND (#1304)
Fix issue apache#1302 - crash on NULL input to UNWIND (apache#1304)
Added integer conversion in toBoolean functions