Skip to content

Commit

Permalink
fix: fix alter index rename (#12944)
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 authored Oct 18, 2023
1 parent 0908740 commit de2b856
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions e2e_test/ddl/alter_rename_relation.slt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public.mv_on_v1 CREATE MATERIALIZED VIEW mv_on_v1 AS SELECT * FROM v5 AS v1
statement ok
ALTER INDEX idx RENAME TO idx1;

query TT
SHOW CREATE INDEX idx1;
----
public.idx1 CREATE INDEX idx1 ON t2(v1)

statement ok
INSERT INTO t2 VALUES(1,(1,(1,2)));

Expand Down
1 change: 1 addition & 0 deletions src/meta/src/manager/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,7 @@ impl CatalogManager {
// 2. rename index name.
index.name = index_name.to_string();
index_table.name = index_name.to_string();
index_table.definition = alter_relation_rename(&index_table.definition, index_name);
let mut indexes = BTreeMapTransaction::new(&mut database_core.indexes);
let mut tables = BTreeMapTransaction::new(&mut database_core.tables);
indexes.insert(index_id, index.clone());
Expand Down

0 comments on commit de2b856

Please sign in to comment.