@@ -36,6 +36,7 @@ use databend_common_ast::ast::TypeName;
36
36
use databend_common_ast:: parser:: parse_values_with_placeholder;
37
37
use databend_common_ast:: parser:: tokenize_sql;
38
38
use databend_common_ast:: Span ;
39
+ use databend_common_catalog:: catalog:: CATALOG_DEFAULT ;
39
40
use databend_common_catalog:: plan:: list_stage_files;
40
41
use databend_common_catalog:: plan:: StageTableInfo ;
41
42
use databend_common_catalog:: table_context:: StageAttachment ;
@@ -57,6 +58,7 @@ use databend_common_meta_app::principal::NullAs;
57
58
use databend_common_meta_app:: principal:: StageInfo ;
58
59
use databend_common_meta_app:: principal:: COPY_MAX_FILES_PER_COMMIT ;
59
60
use databend_common_storage:: StageFilesInfo ;
61
+ use databend_common_storages_stage:: StageTable ;
60
62
use databend_common_users:: UserApiProvider ;
61
63
use derive_visitor:: Drive ;
62
64
use log:: debug;
@@ -321,17 +323,20 @@ impl<'a> Binder {
321
323
)
322
324
. await
323
325
} else {
324
- let ( scan, bind_context) = self
325
- . bind_stage_table (
326
- self . ctx . clone ( ) ,
327
- bind_ctx,
328
- stage_table_info. stage_info . clone ( ) ,
329
- stage_table_info. files_info . clone ( ) ,
330
- & None ,
331
- stage_table_info. files_to_copy . clone ( ) ,
332
- case_sensitive,
333
- )
334
- . await ?;
326
+ let table = StageTable :: try_create ( stage_table_info. clone ( ) ) ?;
327
+ let table_index = self . metadata . write ( ) . add_table (
328
+ CATALOG_DEFAULT . to_string ( ) ,
329
+ "system" . to_string ( ) ,
330
+ table. clone ( ) ,
331
+ None ,
332
+ false ,
333
+ false ,
334
+ true ,
335
+ false ,
336
+ ) ;
337
+
338
+ let ( scan, bind_context) =
339
+ self . bind_base_table ( bind_ctx, "system" , table_index, None , & None ) ?;
335
340
copy_into_table_plan. project_columns = Some ( bind_context. columns . clone ( ) ) ;
336
341
337
342
let copy_into =
0 commit comments