aru-d-at opened a new issue, #871:
URL: https://github.com/apache/age/issues/871

   **Description**
   CALL function with a RETURN crashes psql process instead of throwing Syntax 
error
   
   **Mode:**
   - Command line
   
   **Data Setup:**
   - None
   
   **Configuration:**
   - Default AGE installation with PostgreSQL 12
   
   **Command**
   ```pgsql
   SELECT * FROM cypher('test', $$
       CALL toInteger('1')
       RETURN v
   $$) as (v agtype);
   ```
   ```
   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: Failed.
   !> 
   ```
   
   From Log file
   ```
   TRAP: FailedAssertion("!(self->yield_items)", File: 
"src/backend/parser/cypher_clause.c", Line: 1067)
   2023-04-29 03:14:15.986 +08 [18837] LOG:  server process (PID 19391) was 
terminated by signal 6: Aborted
   2023-04-29 03:14:15.986 +08 [18837] DETAIL:  Failed process was running: 
SELECT * FROM cypher('test', $$
        CALL toInteger('1') RETURN v
        $$) as (v agtype);
   ```
   
   **Expected behavior**
   Should throw syntax error at `RETURN v` instead of crashing
   
   Similar to
   ```
   ERROR:  could not find rte for v
   LINE 3: RETURN v
                  ^
   ```
   
   **Environment:**
   - Version: Tested using 1.1.0 and 1.3.0
   
   **Debugging using GDB**
   ```
   Breakpoint 1, transform_cypher_call_stmt (cpstate=0x28ce0a0, 
clause=0x28ce040) at src/backend/parser/cypher_clause.c:1037
   1037    ParseState *pstate = (ParseState *)cpstate;
   (gdb) s
   1038    cypher_call *self = (cypher_call *)clause->self;
   (gdb) 
   1040    if (!clause->prev && !clause->next) /* CALL [YIELD] -- the most 
simple call */
   (gdb) 
   1067        Assert(self->yield_items);
   (gdb) 
   ExceptionalCondition (conditionName=0x7f205029fb6b "!(self->yield_items)", 
errorType=0x7f205029f716 "FailedAssertion", fileName=0x7f205029f778 
"src/backend/parser/cypher_clause.c", lineNumber=1067) at assert.c:31
   31           if (!PointerIsValid(conditionName)
   (gdb) 
   37                   write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: 
%d)\n",
   (gdb) 
   write_stderr (fmt=fmt@entry=0xa161b0 "TRAP: %s(\"%s\", File: \"%s\", Line: 
%d)\n") at elog.c:3383
   3383 {
   (gdb) 
   3392         va_start(ap, fmt);
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to