Skip to content

Commit

Permalink
Handle information schema tables issue -main (#17116)
Browse files Browse the repository at this point in the history
handle query information_schema.tables report `Cannot find tableID` issue

Approved by: @m-schen, @heni02
  • Loading branch information
qingxinhome committed Jun 24, 2024
1 parent 38ec6a6 commit 07ef07a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pkg/sql/compile/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,18 @@ func (s *Scope) CreateView(c *Compile) error {
)
return err
}

err = maybeCreateAutoIncrement(
c.ctx,
dbSource,
qry.GetTableDef(),
c.proc.TxnOperator,
nil,
)
if err != nil {
return err
}

return nil
}

Expand Down
26 changes: 26 additions & 0 deletions test/distributed/cases/metadata/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,29 @@ order by information_schema.KEY_COLUMN_USAGE.CONSTRAINT_SCHEMA asc,
information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME asc,
information_schema.KEY_COLUMN_USAGE.ORDINAL_POSITION asc;
constraint_schema constraint_name table_name referenced_table_name unique_constraint_name unique_constraint_schema column_name
select table_catalog, table_schema, table_name, table_type, engine
from information_schema.tables
where table_schema = 'mo_catalog' and table_type = 'BASE TABLE'
order by table_name;
table_catalog table_schema table_name table_type engine
def mo_catalog mo_account BASE TABLE Tae
def mo_catalog mo_columns BASE TABLE Tae
def mo_catalog mo_database BASE TABLE Tae
def mo_catalog mo_foreign_keys BASE TABLE Tae
def mo_catalog mo_indexes BASE TABLE Tae
def mo_catalog mo_mysql_compatibility_mode BASE TABLE Tae
def mo_catalog mo_pubs BASE TABLE Tae
def mo_catalog mo_role BASE TABLE Tae
def mo_catalog mo_role_grant BASE TABLE Tae
def mo_catalog mo_role_privs BASE TABLE Tae
def mo_catalog mo_snapshots BASE TABLE Tae
def mo_catalog mo_stages BASE TABLE Tae
def mo_catalog mo_stored_procedure BASE TABLE Tae
def mo_catalog mo_table_partitions BASE TABLE Tae
def mo_catalog mo_tables BASE TABLE Tae
def mo_catalog mo_upgrade BASE TABLE Tae
def mo_catalog mo_upgrade_tenant BASE TABLE Tae
def mo_catalog mo_user BASE TABLE Tae
def mo_catalog mo_user_defined_function BASE TABLE Tae
def mo_catalog mo_user_grant BASE TABLE Tae
def mo_catalog mo_version BASE TABLE Tae
7 changes: 6 additions & 1 deletion test/distributed/cases/metadata/information_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ where (information_schema.REFERENTIAL_CONSTRAINTS.CONSTRAINT_SCHEMA in ('plat_co
information_schema.REFERENTIAL_CONSTRAINTS.CONSTRAINT_SCHEMA in ('plat_content'))
order by information_schema.KEY_COLUMN_USAGE.CONSTRAINT_SCHEMA asc,
information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME asc,
information_schema.KEY_COLUMN_USAGE.ORDINAL_POSITION asc;
information_schema.KEY_COLUMN_USAGE.ORDINAL_POSITION asc;

select table_catalog, table_schema, table_name, table_type, engine
from information_schema.tables
where table_schema = 'mo_catalog' and table_type = 'BASE TABLE'
order by table_name;

0 comments on commit 07ef07a

Please sign in to comment.