Skip to content

Commit

Permalink
Fix duckdb#9742: correctly catch empty ROW case in UPDATE
Browse files Browse the repository at this point in the history
  • Loading branch information
Mytherin committed Nov 21, 2023
1 parent 802c71d commit a3930d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -15,13 +15,13 @@ unique_ptr<ParsedExpression> Transformer::TransformMultiAssignRef(duckdb_libpgqu
return TransformExpression(root.source);
}

int provided_values = func.args ? func.args->length : 0;
// Too many columns (ie. (x, y) = (1, 2, 3) )
if (root.ncolumns < func.args->length) {
if (root.ncolumns < provided_values || !func.args) {
throw ParserException(
"Could not perform multiple assignment, target only expects %d values, %d were provided", root.ncolumns,
func.args->length);
provided_values);
}

// Get the expression corresponding with the current column
idx_t idx = 1;
auto list = func.args->head;
Expand Down
8 changes: 8 additions & 0 deletions test/sql/types/struct/update_empty_row.test
@@ -0,0 +1,8 @@
# name: test/sql/types/struct/update_empty_row.test
# description: Test storing structs in in-memory tables
# group: [struct]

statement error
UPDATE t0 SET ( c0 ) = ROW ( );
----
target only expects 1 values, 0 were provided

0 comments on commit a3930d8

Please sign in to comment.