File tree 2 files changed +10
-2
lines changed
godel-script/godel-frontend/src
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ std::string rule_mangle(const std::string& name) {
127
127
prefix = " GT_" ;
128
128
} else if (starts_with (name, " typecheck_" )) {
129
129
// typecheck_xxx -> TC_xxx
130
- temp = name.substr (11 );
130
+ temp = name.substr (10 );
131
131
prefix = " TC_" ;
132
132
} else {
133
133
// std::cerr << "unknown rule name: " << name << std::endl;
Original file line number Diff line number Diff line change @@ -581,11 +581,18 @@ bool ungrounded_parameter_checker::is_schema_get_primary_key(call_root* node) {
581
581
if (node->get_call_head ()->get_first_expression ()->get_ast_class ()!=ast_class::ac_identifier) {
582
582
return false ;
583
583
}
584
+
584
585
const auto & head_type = node->get_call_head ()->get_resolve ();
586
+ // head type should not be global symbol or data-set type
585
587
if (head_type.is_global || head_type.type .is_set ) {
586
588
return false ;
587
589
}
588
- if (node->get_call_chain ().size ()!=1 ) {
590
+
591
+ // schema get primary key pattern may be:
592
+ // 1. schema.primary_key
593
+ // 2. schema.primary_key.other_calls()
594
+ // so size should be >= 1
595
+ if (node->get_call_chain ().size ()<1 ) {
589
596
return false ;
590
597
}
591
598
const auto name = head_type.type .full_path_name_without_set ();
@@ -602,6 +609,7 @@ bool ungrounded_parameter_checker::is_schema_get_primary_key(call_root* node) {
602
609
return false ;
603
610
}
604
611
const auto key = node->get_call_chain ()[0 ]->get_field_name ()->get_name ();
612
+ // check if the field is primary key
605
613
return sc.fields .count (key) && sc.fields .at (key).primary ;
606
614
}
607
615
You can’t perform that action at this time.
0 commit comments