@@ -174,9 +174,9 @@ impl Binder {
174174 let database = self . check_database_exist ( catalog, database) . await ?;
175175
176176 let mut select_builder = if stmt. with_history {
177- SelectBuilder :: from ( "system.tables_with_history" )
177+ SelectBuilder :: from ( "default. system.tables_with_history" )
178178 } else {
179- SelectBuilder :: from ( "system.tables" )
179+ SelectBuilder :: from ( "default. system.tables" )
180180 } ;
181181
182182 if * full {
@@ -318,21 +318,21 @@ impl Binder {
318318 // Use `system.tables` AS the "base" table to construct the result-set of `SHOW TABLE STATUS ..`
319319 //
320320 // To constraint the schema of the final result-set,
321- // `(select ${select_cols} from system.tables where ..)`
321+ // `(select ${select_cols} from default. system.tables where ..)`
322322 // is used AS a derived table.
323323 // (unlike mysql, alias of derived table is not required in databend).
324324 let query = match limit {
325325 None => format ! (
326- "SELECT {} FROM system.tables WHERE database = '{}' ORDER BY Name" ,
326+ "SELECT {} FROM default. system.tables WHERE database = '{}' ORDER BY Name" ,
327327 select_cols, database
328328 ) ,
329329 Some ( ShowLimit :: Like { pattern } ) => format ! (
330- "SELECT * from (SELECT {} FROM system.tables WHERE database = '{}') \
330+ "SELECT * from (SELECT {} FROM default. system.tables WHERE database = '{}') \
331331 WHERE Name LIKE '{}' ORDER BY Name",
332332 select_cols, database, pattern
333333 ) ,
334334 Some ( ShowLimit :: Where { selection } ) => format ! (
335- "SELECT * from (SELECT {} FROM system.tables WHERE database = '{}') \
335+ "SELECT * from (SELECT {} FROM default. system.tables WHERE database = '{}') \
336336 WHERE ({}) ORDER BY Name",
337337 select_cols, database, selection
338338 ) ,
@@ -353,7 +353,7 @@ impl Binder {
353353
354354 let database = self . check_database_exist ( & None , database) . await ?;
355355
356- let mut select_builder = SelectBuilder :: from ( "system.tables_with_history" ) ;
356+ let mut select_builder = SelectBuilder :: from ( "default. system.tables_with_history" ) ;
357357
358358 select_builder
359359 . with_column ( "name AS Tables" )
0 commit comments