Skip to content

Commit

Permalink
disallow updating system col
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Nov 18, 2024
1 parent 668413c commit 1e53871
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions e2e_test/batch/basic/dml_update.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,11 @@ statement error source for a multiple-column UPDATE item must be a sub-SELECT or
update t set (v1, v2) = v1 + 1;


# Assignment to system columns.
statement error update modifying column `_rw_timestamp` is unsupported
update t set _rw_timestamp = _rw_timestamp + interval '1 second';



statement ok
drop table t;
5 changes: 5 additions & 0 deletions src/frontend/src/binder/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ impl Binder {
)
.into());
}

let col = &table.table_catalog.columns()[id_index];
if !col.can_dml() {
bail_bind_error!("update modifying column `{}` is unsupported", col.name());
}
}

let (returning_list, fields) = self.bind_returning_list(returning_items)?;
Expand Down

0 comments on commit 1e53871

Please sign in to comment.