@@ -345,7 +345,7 @@ impl<'a> ModuleValidatorV10<'a> {
345345 . into_iter ( )
346346 . map ( |index| {
347347 table_validator
348- . validate_index_def_v10 ( index. into ( ) )
348+ . validate_index_def_v10 ( index)
349349 . map ( |index| ( index. name . clone ( ) , index) )
350350 } )
351351 . collect_all_errors :: < StrMap < _ > > ( ) ;
@@ -403,7 +403,11 @@ impl<'a> ModuleValidatorV10<'a> {
403403 if table_type != TableType :: System && name. starts_with ( "st_" ) {
404404 Err ( ValidationError :: TableNameReserved { table : name } . into ( ) )
405405 } else {
406- let name = table_validator. add_to_global_namespace ( name. as_raw ( ) . clone ( ) ) ?;
406+ let mut name = name. as_raw ( ) . clone ( ) ;
407+ if name != raw_table_name {
408+ name = table_validator. add_to_global_namespace ( name) ?;
409+ }
410+
407411 Ok ( name)
408412 }
409413 } ;
@@ -524,7 +528,7 @@ impl<'a> ModuleValidatorV10<'a> {
524528 tables : & HashMap < Identifier , TableDef > ,
525529 ) -> Result < ( ScheduleDef , Identifier ) > {
526530 let RawScheduleDefV10 {
527- source_name,
531+ source_name : _ ,
528532 table_name,
529533 schedule_at_col,
530534 function_name,
@@ -671,7 +675,7 @@ impl<'a> ModuleValidatorV10<'a> {
671675 & return_type,
672676 ) ;
673677
674- let name_result = self . core . resolve_function_ident ( accessor_name. clone ( ) ) ;
678+ let name = self . core . resolve_function_ident ( accessor_name. clone ( ) ) ? ;
675679
676680 let mut view_validator = ViewValidator :: new (
677681 accessor_name. clone ( ) ,
@@ -682,7 +686,7 @@ impl<'a> ModuleValidatorV10<'a> {
682686 & mut self . core ,
683687 ) ?;
684688
685- let name_result = view_validator. add_to_global_namespace ( name_result? . as_raw ( ) . clone ( ) ) ;
689+ let _ = view_validator. add_to_global_namespace ( name . as_raw ( ) . clone ( ) ) ? ;
686690
687691 let n = product_type. elements . len ( ) ;
688692 let return_columns = ( 0 ..n)
@@ -694,11 +698,11 @@ impl<'a> ModuleValidatorV10<'a> {
694698 . map ( |id| view_validator. validate_param_column_def ( id. into ( ) ) )
695699 . collect_all_errors ( ) ;
696700
697- let ( name_result , return_type_for_generate, return_columns, param_columns) =
698- ( name_result , return_type_for_generate, return_columns, param_columns) . combine_errors ( ) ?;
701+ let ( return_type_for_generate, return_columns, param_columns) =
702+ ( return_type_for_generate, return_columns, param_columns) . combine_errors ( ) ?;
699703
700704 Ok ( ViewDef {
701- name : self . core . resolve_function_ident ( name_result . clone ( ) ) ? ,
705+ name,
702706 accessor_name : identifier ( accessor_name) ?,
703707 is_anonymous,
704708 is_public,
@@ -935,16 +939,19 @@ mod tests {
935939 name: "Apples_count_idx_direct" . into( ) ,
936940 codegen_name: Some ( expect_identifier( "Apples_count_idx_direct" ) ) ,
937941 algorithm: DirectAlgorithm { column: 2 . into( ) } . into( ) ,
942+ accessor_name: "Apples_count_idx_direct" . into( ) ,
938943 } ,
939944 & IndexDef {
940945 name: "Apples_name_count_idx_btree" . into( ) ,
941946 codegen_name: Some ( expect_identifier( "Apples_name_count_idx_btree" ) ) ,
942947 algorithm: BTreeAlgorithm { columns: [ 1 , 2 ] . into( ) } . into( ) ,
948+ accessor_name: "Apples_name_count_idx_btree" . into( ) ,
943949 } ,
944950 & IndexDef {
945951 name: "Apples_type_idx_btree" . into( ) ,
946952 codegen_name: Some ( expect_identifier( "Apples_type_idx_btree" ) ) ,
947953 algorithm: BTreeAlgorithm { columns: 3 . into( ) } . into( ) ,
954+ accessor_name: "Apples_type_idx_btree" . into( ) ,
948955 }
949956 ]
950957 ) ;
0 commit comments