Skip to content

Commit

Permalink
fix: consider schema when commenting on a column or table (#19612) (#…
Browse files Browse the repository at this point in the history
…19795)

Co-authored-by: lmatz <[email protected]>
  • Loading branch information
github-actions[bot] and lmatz authored Dec 13, 2024
1 parent 1e226fa commit 23ac7db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions e2e_test/ddl/show.slt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ create schema show_another_schema;
statement ok
create table show_another_schema.t_another (v1 int);

statement ok
comment on table "show_another_schema"."t_another" IS 'test table description with schema';

statement ok
comment on column "show_another_schema"."t_another".v1 IS 'test column description with schema';

statement ok
create table t4 (v1 int);

Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/handler/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub async fn handle_comment(
)?;

let (database_id, schema_id) =
session.get_database_and_schema_id_for_create(schema)?;
let table = binder.bind_table(None, &table, None)?;
session.get_database_and_schema_id_for_create(schema.clone())?;
let table = binder.bind_table(schema.as_deref(), &table, None)?;
binder.bind_columns_to_context(col.real_value(), &table.table_catalog.columns)?;

let column = binder.bind_column(object_name.0.as_slice())?;
Expand All @@ -66,8 +66,8 @@ pub async fn handle_comment(
let (schema, table) =
Binder::resolve_schema_qualified_name(session.database(), object_name)?;
let (database_id, schema_id) =
session.get_database_and_schema_id_for_create(schema)?;
let table = binder.bind_table(None, &table, None)?;
session.get_database_and_schema_id_for_create(schema.clone())?;
let table = binder.bind_table(schema.as_deref(), &table, None)?;

PbComment {
table_id: table.table_id.into(),
Expand Down

0 comments on commit 23ac7db

Please sign in to comment.