Skip to content

Commit 27b08f9

Browse files
authored
fix(sink): Relax some alter table column conditions (#23142)
Co-authored-by: Chiro11 <[email protected]>
1 parent 0a312b1 commit 27b08f9

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

e2e_test/sink/sink_into_table/alter_column.slt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,43 @@ drop table m_drop_1;
355355

356356
statement ok
357357
drop table t_drop_1;
358+
359+
statement ok
360+
create table t1 (v1 int);
361+
362+
statement ok
363+
create table t2 (v1 int primary key, v2 int as v1 + 10, v3 timestamptz as proctime());
364+
365+
statement ok
366+
create sink s1 into t2 from t1;
367+
368+
statement ok
369+
insert into t1 values (1), (2);
370+
371+
query II rowsort
372+
select v1, v2 from t2;
373+
----
374+
1 11
375+
2 12
376+
377+
statement ok
378+
alter table t2 add column v4 int default 100;
379+
380+
statement ok
381+
insert into t1 values (3);
382+
383+
query III rowsort
384+
select v1, v2, v4 from t2;
385+
----
386+
1 11 100
387+
2 12 100
388+
3 13 100
389+
390+
statement ok
391+
drop sink s1;
392+
393+
statement ok
394+
drop table t1;
395+
396+
statement ok
397+
drop table t2;

src/frontend/src/handler/alter_table_column.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ pub async fn handle_alter_table_column(
126126
let (original_catalog, has_incoming_sinks) =
127127
fetch_table_catalog_for_alter(session.as_ref(), &table_name)?;
128128

129-
if has_incoming_sinks && original_catalog.has_generated_column() {
130-
return Err(RwError::from(ErrorCode::BindError(
131-
"Alter a table with incoming sink and generated column has not been implemented."
132-
.to_owned(),
133-
)));
134-
}
135-
136129
if original_catalog.webhook_info.is_some() {
137130
return Err(RwError::from(ErrorCode::BindError(
138131
"Adding/dropping a column of a table with webhook has not been implemented.".to_owned(),

0 commit comments

Comments
 (0)