Skip to content

DuckDB parser crashes when giving empty ROW #9742

Closed
@SteveLeungYL

Description

What happens?

The latest release version of DuckDB (v0.9.1 401c8061c6ece) crashes when executing the following query:

UPDATE t0 SET ( c0 ) = ROW ( );

Here is the stack trace from GDB:

#0  0x0000aaaaabb10ba4 in duckdb::Transformer::TransformMultiAssignRef (this=this@entry=0xffffffffd0f0, root=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transform/expression/transform_multi_assign_reference.cpp:19
#1  0x0000aaaaabb0cc44 in duckdb::Transformer::TransformExpression (this=this@entry=0xffffffffd0f0, node=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transform/expression/transform_expression.cpp:79
#2  0x0000aaaaabb0cf74 in duckdb::Transformer::TransformExpression (this=this@entry=0xffffffffd0f0, node=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/include/duckdb/common/optional_ptr.hpp:35
#3  0x0000aaaaab5a61bc in duckdb::Transformer::TransformUpdateSetInfo (this=this@entry=0xffffffffd0f0, target_list=<optimized out>, where_clause=0xaaaaac6bc9e0)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/include/duckdb/common/optional_ptr.hpp:43
#4  0x0000aaaaab5a66c8 in duckdb::Transformer::TransformUpdate (this=this@entry=0xffffffffd0f0, stmt=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/include/duckdb/common/unique_ptr.hpp:38
#5  0x0000aaaaaaf657a8 in duckdb::Transformer::TransformStatementInternal (this=this@entry=0xffffffffd0f0, stmt=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transformer.cpp:165
#6  0x0000aaaaaaf658e4 in duckdb::Transformer::TransformStatement (this=this@entry=0xffffffffd0f0, stmt=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transformer.cpp:60
#7  0x0000aaaaaaf657fc in duckdb::Transformer::TransformStatementInternal (this=this@entry=0xffffffffd0f0, stmt=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transformer.cpp:135
#8  0x0000aaaaaaf658e4 in duckdb::Transformer::TransformStatement (this=this@entry=0xffffffffd0f0, stmt=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/transformer.cpp:60
#9  0x0000aaaaaaf662c4 in duckdb::Transformer::TransformParseTree (this=this@entry=0xffffffffd0f0, tree=<optimized out>, statements=...)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/include/duckdb/common/optional_ptr.hpp:35
#10 0x0000aaaaaaf6a4c0 in duckdb::Parser::ParseQuery (this=this@entry=0xffffffffd398,
    query="UPDATE ONLY v0 . v1099 AS a21 SET ( v0 ) = ROW ( ), ( v0 ) = DEFAULT, WHERE DEFAULT IN ( PIVOT LATERAL ROWS FROM ( v0 ( ) ) CROSS JOIN v1099 ASOF JOIN v1099 ON TRUE POSITIONAL JOIN v1099 ASOF JOIN v10"...) at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/src/parser/parser.cpp:178
#11 0x0000aaaaaaf53de8 in duckdb_shell_sqlite3_prepare_v2 (db=0xaaaaac58c8e0,
    zSql=0xaaaaac5a1450 "UPDATE ONLY v0 . v1099 AS a21 SET ( v0 ) = ROW ( ), ( v0 ) = DEFAULT, WHERE DEFAULT IN ( PIVOT LATERAL ROWS FROM ( v0 ( ) ) CROSS JOIN v1099 ASOF JOIN v1099 ON TRUE POSITIONAL JOIN v1099 ASOF JOIN v10"..., nByte=<optimized out>, ppStmt=0xffffffffd5e0, pzTail=0xffffffffd5e8)
    at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/tools/sqlite3_api_wrapper/sqlite3_api_wrapper.cpp:170
#12 0x0000aaaaaaf3d800 in shell_exec (pArg=0xffffffffd908,
    zSql=0xaaaaac5a1450 "UPDATE ONLY v0 . v1099 AS a21 SET ( v0 ) = ROW ( ), ( v0 ) = DEFAULT, WHERE DEFAULT IN ( PIVOT LATERAL ROWS FROM ( v0 ( ) ) CROSS JOIN v1099 ASOF JOIN v1099 ON TRUE POSITIONAL JOIN v1099 ASOF JOIN v10"..., pzErrMsg=<optimized out>) at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/tools/shell/shell.c:13142
#13 0x0000aaaaaaf3f484 in runOneSqlLine (p=0xffffffffd908,
    zSql=0xaaaaac5a1450 "UPDATE ONLY v0 . v1099 AS a21 SET ( v0 ) = ROW ( ), ( v0 ) = DEFAULT, WHERE DEFAULT IN ( PIVOT LATERAL ROWS FROM ( v0 ( ) ) CROSS JOIN v1099 ASOF JOIN v1099 ON TRUE POSITIONAL JOIN v1099 ASOF JOIN v10"..., in=0x0, startline=1) at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/tools/shell/shell.c:19654
#14 0x0000aaaaaaf46afc in process_input (p=0xffffffffd908) at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/tools/shell/shell.c:19772
#15 0x0000aaaaaaf29fec in main (argc=<optimized out>, argv=0xffffffffec68) at /Users/sly/Desktop/Projects/DBMSs/duckdb/duckdb_ori/tools/shell/shell.c:20585

The bug is also reproducible from the latest main branch (60ddc316ca0c1)

To Reproduce

  1. Clone the DuckDB Git from the official repo.
  2. Checkout to either the latest main or release version: 0.9.1 (401c8061c6ece).
  3. Compile the DuckDB binary by using either make reldebug or make debug.
  4. Run the compiled DuckDB and input the following SQL:
UPDATE t0 SET ( c0 ) = ROW ( );
  1. Observe and log the crash information.

OS:

Ubuntu 20.04 LTS

DuckDB Version:

v0.9.1 401c806

DuckDB Client:

DuckDB official command line client

Full Name:

Yu Liang

Affiliation:

The Pennsylvania State University

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions