Skip to content

Commit

Permalink
Merge pull request #12183 from Mytherin/createindexcorrectdb
Browse files Browse the repository at this point in the history
Mark correct database as modified in CreateIndex
hannes authored May 22, 2024
2 parents 62d61a4 + 7a841e0 commit 70fd6a8
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/planner/binder/statement/bind_create.cpp
Original file line number Diff line number Diff line change
@@ -613,9 +613,6 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
case CatalogType::INDEX_ENTRY: {
auto &base = stmt.info->Cast<CreateIndexInfo>();

auto catalog = BindCatalog(base.catalog);
properties.modified_databases.insert(catalog);

// visit the table reference
auto table_ref = make_uniq<BaseTableRef>();
table_ref->catalog_name = base.catalog;
@@ -631,6 +628,8 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
if (table.temporary) {
stmt.info->temporary = true;
}
properties.modified_databases.insert(table.catalog.GetName());

// create a plan over the bound table
auto plan = CreatePlan(*bound_table);
if (plan->type != LogicalOperatorType::LOGICAL_GET) {
14 changes: 14 additions & 0 deletions test/sql/attach/attach_create_index.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# name: test/sql/attach/attach_create_index.test
# description: Test create index on an attached database with an alias
# group: [attach]

require skip_reload

statement ok
ATTACH '' AS tmp;

statement ok
CREATE TABLE tmp.t1(id int);

statement ok
CREATE INDEX idx ON tmp.t1(id);

0 comments on commit 70fd6a8

Please sign in to comment.