← Open Source & Engineering Work
DuckDB Foundation · duckdb/duckdbMerged · DuckDB Core (PR #26443)

Fix #26362: Null dereference in PIVOT IN list with zero-argument row()

Sole Author: Patrick Ribbsaeter (@patrickswedish) · Immutable Commit SHA: bbec3354bdee247f8e643aa6b15abfaff60d0bb6

Analytical SQL engine parser and binder fix preserving empty child lists in zero-argument row() expressions and rejecting empty PIVOT IN row tuples cleanly instead of dereferencing a null pointer.

Fix #26362: Null dereference in PIVOT IN list with zero-argument row()

PR #26443

Merged Mainline

bbec335

Immutable Git SHA

C++

Systems

46/46 CI Green

CI & Test Matrix

01 · Engineering problem

The failure mode

Constructing a PIVOT IN list containing a zero-argument row() expression triggered a null pointer dereference across DuckDB's PEG transformer and pivot binder due to unguarded empty child-expression lists.

02 · Technical response

What changed

  1. 01Added explicit null and empty-children safety guards in transform_select.cpp and bind_pivot.cpp.
  2. 02Converted malformed zero-argument row() PIVOT IN expressions into deterministic binder errors instead of process crashes.
  3. 03Added SQL logic regression tests in test/sql/pivot/pivot_errors.test.

03 · Verified outcome

Evidence-backed result

  • ✓Eliminated segmentation faults on malformed zero-argument row() PIVOT queries.
  • ✓Merged upstream into duckdb/duckdb main branch as commit bbec3354bdee247f8e643aa6b15abfaff60d0bb6.

04 · Cryptographic Git record

Immutable source evidence

C++DuckDBSQL BinderPEG ParserOLAP Engines

Independent open-source engineering authored solely by Patrick Ribbsaeter (@patrickswedish). Company and project names identify the public repository context only under nominative fair use. No employment, client, vendor, or partnership relationship is implied unless explicitly stated.