Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: linter error (#16951)

Danny Xu15c2faf2e329
diff --git a/backend/api/v1/catalog_masking.go b/backend/api/v1/catalog_masking.go
index 93f09a3ec9..e79ba2dee9 100644
--- a/backend/api/v1/catalog_masking.go
+++ b/backend/api/v1/catalog_masking.go
@@ -165,6 +165,9 @@ func getObjectSchemaByPath(objectSchema *storepb.ObjectSchema, path *base.PathAS
}
outer = inner
outerSemanticType = outer.SemanticType
+ default:
+ // Other schema types
+ return nil, outerSemanticType
}
}
diff --git a/backend/api/v1/common.go b/backend/api/v1/common.go
index b512eec5bb..cd9e70871e 100644
--- a/backend/api/v1/common.go
+++ b/backend/api/v1/common.go
@@ -313,6 +313,7 @@ func convertToEngine(engine storepb.Engine) v1pb.Engine {
return v1pb.Engine_CASSANDRA
case storepb.Engine_TRINO:
return v1pb.Engine_TRINO
+ default:
}
return v1pb.Engine_ENGINE_UNSPECIFIED
}
@@ -375,6 +376,7 @@ func convertEngine(engine v1pb.Engine) storepb.Engine {
return storepb.Engine_CASSANDRA
case v1pb.Engine_TRINO:
return storepb.Engine_TRINO
+ default:
}
return storepb.Engine_ENGINE_UNSPECIFIED
}
@@ -450,6 +452,7 @@ func convertExportFormat(format storepb.ExportFormat) v1pb.ExportFormat {
return v1pb.ExportFormat_SQL
case storepb.ExportFormat_XLSX:
return v1pb.ExportFormat_XLSX
+ default:
}
return v1pb.ExportFormat_FORMAT_UNSPECIFIED
}
@@ -464,6 +467,7 @@ func convertToExportFormat(format v1pb.ExportFormat) storepb.ExportFormat {
return storepb.ExportFormat_SQL
case v1pb.ExportFormat_XLSX:
return storepb.ExportFormat_XLSX
+ default:
}
return storepb.ExportFormat_FORMAT_UNSPECIFIED
}
diff --git a/backend/api/v1/database_catalog_service.go b/backend/api/v1/database_catalog_service.go
index 0c3b9cf8ce..af6bdf7a77 100644
--- a/backend/api/v1/database_catalog_service.go
+++ b/backend/api/v1/database_catalog_service.go
@@ -141,6 +141,7 @@ func convertStoreObjectSchema(objectSchema *storepb.ObjectSchema) *v1pb.ObjectSc
o.Type = v1pb.ObjectSchema_OBJECT
case storepb.ObjectSchema_ARRAY:
o.Type = v1pb.ObjectSchema_ARRAY
+ default:
}
switch objectSchema.Kind.(type) {
case *storepb.ObjectSchema_StructKind_:
@@ -215,6 +216,7 @@ func convertV1ObjectSchema(objectSchema *v1pb.ObjectSchema) *storepb.ObjectSchem
o.Type = storepb.ObjectSchema_OBJECT
case v1pb.ObjectSchema_ARRAY:
o.Type = storepb.ObjectSchema_ARRAY
+ default:
}
switch objectSchema.Kind.(type) {
case *v1pb.ObjectSchema_StructKind_:
diff --git a/backend/api/v1/database_service.go b/backend/api/v1/database_service.go
index 39b983ab92..7eb6651bcb 100644
--- a/backend/api/v1/database_service.go
+++ b/backend/api/v1/database_service.go
@@ -118,6 +118,7 @@ func getVariableAndValueFromExpr(expr celast.Expr) (string, any) {
}
}
value = list
+ default:
}
}
return variable, value
@@ -499,6 +500,7 @@ func (s *DatabaseService) UpdateDatabase(ctx context.Context, req *connect.Reque
return nil, errors.Wrapf(err, "failed to create changelog")
}
patch.Metadata.Drifted = false
+ default:
}
}
@@ -794,6 +796,7 @@ func (s *DatabaseService) GetDatabaseSchema(ctx context.Context, req *connect.Re
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert schema to sdl format, error %v", err.Error()))
}
schema = sdlSchema
+ default:
}
}
return connect.NewResponse(&v1pb.DatabaseSchema{Schema: schema}), nil
diff --git a/backend/api/v1/database_service_changelog.go b/backend/api/v1/database_service_changelog.go
index 503e277b64..d7fc01a79c 100644
--- a/backend/api/v1/database_service_changelog.go
+++ b/backend/api/v1/database_service_changelog.go
@@ -144,6 +144,7 @@ func (s *DatabaseService) GetChangelog(ctx context.Context, req *connect.Request
}
converted.PrevSchema = sdlSchema
converted.PrevSchemaSize = int64(len(sdlSchema))
+ default:
}
}
return connect.NewResponse(converted), nil
diff --git a/backend/api/v1/group_service.go b/backend/api/v1/group_service.go
index 461907cf31..d41ab01530 100644
--- a/backend/api/v1/group_service.go
+++ b/backend/api/v1/group_service.go
@@ -320,6 +320,7 @@ func (s *GroupService) convertToV1Group(ctx context.Context, groupMessage *store
m.Role = v1pb.GroupMember_MEMBER
case storepb.GroupMember_OWNER:
m.Role = v1pb.GroupMember_OWNER
+ default:
}
group.Members = append(group.Members, m)
}
diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.go
index 5b05f8dd8c..23391d5a88 100644
--- a/backend/api/v1/idp_service.go
+++ b/backend/api/v1/idp_service.go
@@ -139,6 +139,7 @@ func (s *IdentityProviderService) UpdateIdentityProvider(ctx context.Context, re
patch.Domain = &req.Msg.IdentityProvider.Domain
case "config":
patch.Config = convertIdentityProviderConfigToStore(req.Msg.IdentityProvider.Config)
+ default:
}
}
if patch.Config != nil {
@@ -159,6 +160,7 @@ func (s *IdentityProviderService) UpdateIdentityProvider(ctx context.Context, re
if req.Msg.IdentityProvider.Config.GetLdapConfig().BindPassword == "" {
patch.Config.GetLdapConfig().BindPassword = identityProviderMessage.Config.GetLdapConfig().BindPassword
}
+ default:
}
}
diff --git a/backend/api/v1/instance_service.go b/backend/api/v1/instance_service.go
index f1ccc8dc18..336b20f3a5 100644
--- a/backend/api/v1/instance_service.go
+++ b/backend/api/v1/instance_service.go
@@ -859,6 +859,7 @@ func (s *InstanceService) UpdateDataSource(ctx context.Context, req *connect.Req
} else {
dataSource.IamExtension = nil
}
+ default:
}
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf(`unsupported update_mask "%s"`, path))
@@ -1123,6 +1124,7 @@ func convertDataSourceExternalSecret(externalSecret *storepb.DataSourceExternalS
resp.AuthOption = &v1pb.DataSourceExternalSecret_Token{
Token: "",
}
+ default:
}
return resp
@@ -1139,6 +1141,7 @@ func convertDataSources(dataSources []*storepb.DataSource) []*v1pb.DataSource {
dataSourceType = v1pb.DataSourceType_ADMIN
case storepb.DataSourceType_READ_ONLY:
dataSourceType = v1pb.DataSourceType_READ_ONLY
+ default:
}
authenticationType := v1pb.DataSource_AUTHENTICATION_UNSPECIFIED
@@ -1151,6 +1154,7 @@ func convertDataSources(dataSources []*storepb.DataSource) []*v1pb.DataSource {
authenticationType = v1pb.DataSource_AWS_RDS_IAM
case storepb.DataSource_AZURE_IAM:
authenticationType = v1pb.DataSource_AZURE_IAM
+ default:
}
dataSource := &v1pb.DataSource{
@@ -1205,6 +1209,7 @@ func convertDataSources(dataSources []*storepb.DataSource) []*v1pb.DataSource {
GcpCredential: &v1pb.DataSource_GCPCredential{},
}
}
+ default:
}
v1DataSources = append(v1DataSources, dataSource)
@@ -1264,6 +1269,7 @@ func convertV1DataSourceExternalSecret(externalSecret *v1pb.DataSourceExternalSe
if secret.SecretName == "" {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("missing GCP secret name"))
}
+ default:
}
switch secret.AuthType {
@@ -1275,6 +1281,7 @@ func convertV1DataSourceExternalSecret(externalSecret *v1pb.DataSourceExternalSe
if secret.GetAppRole() == nil {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("missing Vault approle"))
}
+ default:
}
return secret, nil
@@ -1361,6 +1368,7 @@ func convertV1AuthenticationType(authType v1pb.DataSource_AuthenticationType) st
authenticationType = storepb.DataSource_AWS_RDS_IAM
case v1pb.DataSource_AZURE_IAM:
authenticationType = storepb.DataSource_AZURE_IAM
+ default:
}
return authenticationType
}
@@ -1374,6 +1382,7 @@ func convertV1RedisType(redisType v1pb.DataSource_RedisType) storepb.DataSource_
authenticationType = storepb.DataSource_SENTINEL
case v1pb.DataSource_CLUSTER:
authenticationType = storepb.DataSource_CLUSTER
+ default:
}
return authenticationType
}
@@ -1387,6 +1396,7 @@ func convertRedisType(redisType storepb.DataSource_RedisType) v1pb.DataSource_Re
authenticationType = v1pb.DataSource_SENTINEL
case storepb.DataSource_CLUSTER:
authenticationType = v1pb.DataSource_CLUSTER
+ default:
}
return authenticationType
}
@@ -1468,6 +1478,7 @@ func convertV1DataSource(dataSource *v1pb.DataSource) (*storepb.DataSource, erro
},
}
}
+ default:
}
return storeDataSource, nil
diff --git a/backend/api/v1/issue_service.go b/backend/api/v1/issue_service.go
index 63b5150ef9..653195e5ba 100644
--- a/backend/api/v1/issue_service.go
+++ b/backend/api/v1/issue_service.go
@@ -235,6 +235,8 @@ func (s *IssueService) getIssueFind(ctx context.Context, filter string, query st
default:
return "", connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupport variable %q with %v operator", variable, celoperators.In))
}
+ default:
+ return "", connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupported function %q", functionName))
}
default:
return "", errors.Errorf("unexpected expr kind %v", expr.Kind())
@@ -1220,6 +1222,7 @@ func (s *IssueService) UpdateIssue(ctx context.Context, req *connect.Request[v1p
},
},
})
+ default:
}
}
diff --git a/backend/api/v1/issue_service_convert.go b/backend/api/v1/issue_service_convert.go
index 5e2dd13f2b..80cb7c0a2c 100644
--- a/backend/api/v1/issue_service_convert.go
+++ b/backend/api/v1/issue_service_convert.go
@@ -135,6 +135,8 @@ func (s *IssueService) convertToIssueReleasers(ctx context.Context, issue *store
}
releasers = append(releasers, common.FormatUserEmail(user.Email))
}
+ default:
+ // Handle other roles
}
}
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index 7d3369241e..fb6f0864fa 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -171,6 +171,7 @@ func (s *OrgPolicyService) UpdatePolicy(ctx context.Context, req *connect.Reques
patch.Payload = &payloadStr
case "enforce":
patch.Enforce = &req.Msg.Policy.Enforce
+ default:
}
}
@@ -473,6 +474,7 @@ func (s *OrgPolicyService) convertPolicyPayloadToString(ctx context.Context, pol
return "", errors.Wrap(err, "failed to marshal data source query policy")
}
return string(payloadBytes), nil
+ default:
}
return "", connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid policy %v", policy.Type))
@@ -487,6 +489,7 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *s
resourceType = v1pb.PolicyResourceType_ENVIRONMENT
case storepb.Policy_PROJECT:
resourceType = v1pb.PolicyResourceType_PROJECT
+ default:
}
policy := &v1pb.Policy{
InheritFromParent: policyMessage.InheritFromParent,
@@ -558,6 +561,7 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *s
return nil, err
}
policy.Policy = payload
+ default:
}
policy.Type = pType
@@ -580,6 +584,7 @@ func convertToV1PBSQLReviewRules(ruleList []*storepb.SQLReviewRule) []*v1pb.SQLR
level = v1pb.SQLReviewRuleLevel_WARNING
case storepb.SQLReviewRuleLevel_DISABLED:
level = v1pb.SQLReviewRuleLevel_DISABLED
+ default:
}
rules = append(rules, &v1pb.SQLReviewRule{
Level: level,
@@ -627,6 +632,7 @@ func convertToV1PBAction(action storepb.MaskingExceptionPolicy_MaskingException_
return v1pb.MaskingExceptionPolicy_MaskingException_QUERY
case storepb.MaskingExceptionPolicy_MaskingException_EXPORT:
return v1pb.MaskingExceptionPolicy_MaskingException_EXPORT
+ default:
}
return v1pb.MaskingExceptionPolicy_MaskingException_ACTION_UNSPECIFIED
}
@@ -639,6 +645,7 @@ func convertToStorePBAction(action v1pb.MaskingExceptionPolicy_MaskingException_
return storepb.MaskingExceptionPolicy_MaskingException_QUERY
case v1pb.MaskingExceptionPolicy_MaskingException_EXPORT:
return storepb.MaskingExceptionPolicy_MaskingException_EXPORT
+ default:
}
return storepb.MaskingExceptionPolicy_MaskingException_ACTION_UNSPECIFIED
}
@@ -865,6 +872,7 @@ func convertV1PBToStorePBPolicyType(pType v1pb.PolicyType) (storepb.Policy_Type,
return storepb.Policy_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW, nil
case v1pb.PolicyType_DATA_SOURCE_QUERY:
return storepb.Policy_DATA_SOURCE_QUERY, nil
+ default:
}
return storepb.Policy_TYPE_UNSPECIFIED, errors.Errorf("invalid policy type %v", pType)
}
@@ -889,6 +897,7 @@ func convertStorePBToV1PBPolicyType(pType storepb.Policy_Type) v1pb.PolicyType {
return v1pb.PolicyType_RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW
case storepb.Policy_DATA_SOURCE_QUERY:
return v1pb.PolicyType_DATA_SOURCE_QUERY
+ default:
}
return v1pb.PolicyType_POLICY_TYPE_UNSPECIFIED
}
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index 2be405d684..be2ee9e174 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -566,6 +566,8 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *connect.Request[v
},
})
}
+ default:
+ // Other task types
}
return nil
}(); err != nil {
@@ -1379,6 +1381,8 @@ func getTaskTypeFromSpec(spec *v1pb.Plan_Spec) (storepb.Task_Type, error) {
return storepb.Task_DATABASE_SCHEMA_UPDATE, nil
case v1pb.Plan_ChangeDatabaseConfig_MIGRATE_GHOST:
return storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST, nil
+ default:
+ return storepb.Task_TASK_TYPE_UNSPECIFIED, errors.Errorf("invalid change database config type %s", s.ChangeDatabaseConfig.Type)
}
case *v1pb.Plan_Spec_ExportDataConfig:
return storepb.Task_DATABASE_EXPORT, nil
diff --git a/backend/api/v1/plan_service_plan_check.go b/backend/api/v1/plan_service_plan_check.go
index fa9af5d1cb..d1d4cc5d3f 100644
--- a/backend/api/v1/plan_service_plan_check.go
+++ b/backend/api/v1/plan_service_plan_check.go
@@ -234,6 +234,7 @@ func convertToChangeDatabaseType(t storepb.PlanConfig_ChangeDatabaseConfig_Type)
return storepb.PlanCheckRunConfig_SDL
case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
return storepb.PlanCheckRunConfig_DML
+ default:
}
return storepb.PlanCheckRunConfig_CHANGE_DATABASE_TYPE_UNSPECIFIED
}
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index ca06e64558..4a106bf4ec 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -1595,6 +1595,8 @@ func validateExpirationInExpression(expr string, maximumRoleExpiration *duration
return errors.Errorf("expect string, got %T, hint: filter literals should be string", arg.AsLiteral().Value())
}
value = lit
+ default:
+ // Other arg kinds
}
}
diff --git a/backend/api/v1/release_service.go b/backend/api/v1/release_service.go
index a21320c060..87b44ee4b2 100644
--- a/backend/api/v1/release_service.go
+++ b/backend/api/v1/release_service.go
@@ -456,6 +456,7 @@ func validateAndSanitizeReleaseFiles(ctx context.Context, s *store.Store, files
// populate sheetSha256 from statement
h := sha256.Sum256(f.Statement)
f.SheetSha256 = hex.EncodeToString(h[:])
+ default:
}
switch f.Type {
diff --git a/backend/api/v1/release_service_check.go b/backend/api/v1/release_service_check.go
index 7043912d1f..7c5dfd3443 100644
--- a/backend/api/v1/release_service_check.go
+++ b/backend/api/v1/release_service_check.go
@@ -206,6 +206,8 @@ func (s *ReleaseService) CheckRelease(ctx context.Context, req *connect.Request[
changeType = storepb.PlanCheckRunConfig_DDL_GHOST
case v1pb.Release_File_DML:
changeType = storepb.PlanCheckRunConfig_DML
+ default:
+ // Keep DDL as default change type
}
// Get SQL summary report for the statement and target database.
// Including affected rows.
@@ -377,6 +379,8 @@ func (s *ReleaseService) runSQLReviewCheckForFile(
adviceLevel = storepb.Advice_ERROR
case storepb.Advice_SUCCESS, storepb.Advice_STATUS_UNSPECIFIED:
continue
+ default:
+ // Other advice statuses
}
advices = append(advices, convertToV1Advice(advice))
}
@@ -404,6 +408,7 @@ func convertRiskLevel(riskLevel int32) (v1pb.CheckReleaseResponse_RiskLevel, err
return v1pb.CheckReleaseResponse_MODERATE, nil
case 300:
return v1pb.CheckReleaseResponse_HIGH, nil
+ default:
+ return v1pb.CheckReleaseResponse_RISK_LEVEL_UNSPECIFIED, errors.Errorf("unexpected risk level %d", riskLevel)
}
- return v1pb.CheckReleaseResponse_RISK_LEVEL_UNSPECIFIED, errors.Errorf("unexpected risk level %d", riskLevel)
}
diff --git a/backend/api/v1/review_config_service.go b/backend/api/v1/review_config_service.go
index b49c1da8a3..521b0c1b1b 100644
--- a/backend/api/v1/review_config_service.go
+++ b/backend/api/v1/review_config_service.go
@@ -240,6 +240,7 @@ func (s *ReviewConfigService) convertToV1ReviewConfig(ctx context.Context, revie
continue
}
config.Resources = append(config.Resources, common.FormatProject(project.ResourceID))
+ default:
}
}
@@ -284,6 +285,7 @@ func validateSQLReviewRules(rules []*v1pb.SQLReviewRule) error {
if _, err := advisor.UnmarshalNamingCaseRulePayload(rule.Payload); err != nil {
return err
}
+ default:
}
}
return nil
diff --git a/backend/api/v1/risk_service.go b/backend/api/v1/risk_service.go
index c6dc18d43d..2ce9c4e2da 100644
--- a/backend/api/v1/risk_service.go
+++ b/backend/api/v1/risk_service.go
@@ -121,6 +121,7 @@ func (s *RiskService) UpdateRisk(ctx context.Context, request *connect.Request[v
if risk.Source != source {
patch.Source = &source
}
+ default:
}
}
@@ -174,6 +175,7 @@ func ConvertToV1Source(source store.RiskSource) v1pb.Risk_Source {
return v1pb.Risk_DATA_EXPORT
case store.RiskRequestRole:
return v1pb.Risk_REQUEST_ROLE
+ default:
}
return v1pb.Risk_SOURCE_UNSPECIFIED
}
@@ -190,6 +192,7 @@ func convertToSource(source v1pb.Risk_Source) store.RiskSource {
return store.RiskSourceDatabaseDataExport
case v1pb.Risk_REQUEST_ROLE:
return store.RiskRequestRole
+ default:
}
return store.RiskSourceUnknown
}
diff --git a/backend/api/v1/rollout_service_converter.go b/backend/api/v1/rollout_service_converter.go
index 3771a9b423..4989cdfc1d 100644
--- a/backend/api/v1/rollout_service_converter.go
+++ b/backend/api/v1/rollout_service_converter.go
@@ -305,8 +305,9 @@ func convertToPlanCheckRunType(t store.PlanCheckRunType) v1pb.PlanCheckRun_Type
return v1pb.PlanCheckRun_DATABASE_CONNECT
case store.PlanCheckDatabaseGhostSync:
return v1pb.PlanCheckRun_DATABASE_GHOST_SYNC
+ default:
+ return v1pb.PlanCheckRun_TYPE_UNSPECIFIED
}
- return v1pb.PlanCheckRun_TYPE_UNSPECIFIED
}
func convertToPlanCheckRunStatus(status store.PlanCheckRunStatus) v1pb.PlanCheckRun_Status {
@@ -319,8 +320,9 @@ func convertToPlanCheckRunStatus(status store.PlanCheckRunStatus) v1pb.PlanCheck
return v1pb.PlanCheckRun_FAILED
case store.PlanCheckRunStatusRunning:
return v1pb.PlanCheckRun_RUNNING
+ default:
+ return v1pb.PlanCheckRun_STATUS_UNSPECIFIED
}
- return v1pb.PlanCheckRun_STATUS_UNSPECIFIED
}
func convertToPlanCheckRunResults(results []*storepb.PlanCheckRunResult_Result) []*v1pb.PlanCheckRun_Result {
@@ -371,8 +373,9 @@ func convertToPlanCheckRunResultStatus(status storepb.PlanCheckRunResult_Result_
return v1pb.PlanCheckRun_Result_WARNING
case storepb.PlanCheckRunResult_Result_ERROR:
return v1pb.PlanCheckRun_Result_ERROR
+ default:
+ return v1pb.PlanCheckRun_Result_STATUS_UNSPECIFIED
}
- return v1pb.PlanCheckRun_Result_STATUS_UNSPECIFIED
}
func convertToTaskRuns(ctx context.Context, s *store.Store, stateCfg *state.State, taskRuns []*store.TaskRunMessage) ([]*v1pb.TaskRun, error) {
@@ -1002,6 +1005,7 @@ func convertToTaskRunLogEntries(logs []*store.TaskRunLog) []*v1pb.TaskRunLogEntr
},
}
entries = append(entries, e)
+ default:
}
}
diff --git a/backend/api/v1/rollout_service_task.go b/backend/api/v1/rollout_service_task.go
index 710d472600..08bc1b2ee9 100644
--- a/backend/api/v1/rollout_service_task.go
+++ b/backend/api/v1/rollout_service_task.go
@@ -141,6 +141,8 @@ func getTaskCreatesFromCreateDatabaseConfig(ctx context.Context, s *store.Store,
if lowerCaseTableNames == 1 {
databaseName = strings.ToLower(databaseName)
}
+ default:
+ // Other engines use the original database name
}
statement, err := getCreateDatabaseStatement(instance.Metadata.GetEngine(), c, databaseName, adminDataSource.GetUsername())
@@ -569,6 +571,7 @@ func getCreateDatabaseStatement(dbType storepb.Engine, c *storepb.PlanConfig_Cre
return fmt.Sprintf("%s;", stmt), nil
case storepb.Engine_HIVE:
return fmt.Sprintf("CREATE DATABASE %s;", databaseName), nil
+ default:
+ return "", errors.Errorf("unsupported database type %s", dbType)
}
- return "", errors.Errorf("unsupported database type %s", dbType)
}
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index f0e65bdd54..a8cc6ac7ef 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -927,6 +927,7 @@ func convertStoreSettingNameToV1(storeName storepb.SettingName) v1pb.Setting_Set
return v1pb.Setting_PASSWORD_RESTRICTION
case storepb.SettingName_ENVIRONMENT:
return v1pb.Setting_ENVIRONMENT
+ default:
}
return v1pb.Setting_SETTING_NAME_UNSPECIFIED
}
@@ -1234,6 +1235,7 @@ func convertV1WorkspaceProfileSettingToStore(v1Setting *v1pb.WorkspaceProfileSet
storeSetting.Announcement.Level = storepb.Announcement_ALERT_LEVEL_WARNING
case v1pb.Announcement_CRITICAL:
storeSetting.Announcement.Level = storepb.Announcement_ALERT_LEVEL_CRITICAL
+ default:
}
}
@@ -1274,6 +1276,7 @@ func convertStoreWorkspaceProfileSettingToV1(storeSetting *storepb.WorkspaceProf
v1Setting.Announcement.Level = v1pb.Announcement_WARNING
case storepb.Announcement_ALERT_LEVEL_CRITICAL:
v1Setting.Announcement.Level = v1pb.Announcement_CRITICAL
+ default:
}
}
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index ea2ef839d9..db3de31d96 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -1181,6 +1181,7 @@ func (s *SQLService) convertToV1QueryHistory(ctx context.Context, history *store
historyType = v1pb.QueryHistory_EXPORT
case store.QueryHistoryTypeQuery:
historyType = v1pb.QueryHistory_QUERY
+ default:
}
return &v1pb.QueryHistory{
@@ -1338,6 +1339,7 @@ func (s *SQLService) accessCheck(
permission = iam.PermissionSQLInfo
case parserbase.Select:
// Conditional permission check below.
+ default:
}
if isExplain {
permission = iam.PermissionSQLExplain
@@ -1685,6 +1687,7 @@ func (s *SQLService) SQLReviewCheck(
adviceLevel = storepb.Advice_ERROR
case storepb.Advice_SUCCESS, storepb.Advice_STATUS_UNSPECIFIED:
continue
+ default:
}
advices = append(advices, convertToV1Advice(advice))
@@ -1984,6 +1987,7 @@ func checkDataSourceQueryPolicy(ctx context.Context, storeInstance *store.Store,
if policy.DisallowDml {
return connect.NewError(connect.CodePermissionDenied, errors.Errorf("disallow execute DML statement in environment %q", environment.Title))
}
+ default:
}
}
return nil
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index 61010a34d4..49cb3899eb 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -568,6 +568,7 @@ func (s *UserService) UpdateUser(ctx context.Context, request *connect.Request[v
}
}
patch.Phone = &request.Msg.User.Phone
+ default:
}
}
if passwordPatch != nil {
diff --git a/backend/api/v1/worksheet_service.go b/backend/api/v1/worksheet_service.go
index 9ea2abef3c..8f1e8118cd 100644
--- a/backend/api/v1/worksheet_service.go
+++ b/backend/api/v1/worksheet_service.go
@@ -553,9 +553,9 @@ func (s *WorksheetService) canWriteWorksheet(ctx context.Context, worksheet *sto
case store.ProjectWriteWorkSheet:
// For READ visibility, needs "bb.worksheets.get" permission in the project.
return s.checkWorksheetPermission(ctx, worksheet.ProjectID, user, iam.PermissionWorksheetsGet)
+ default:
+ return false, nil
}
-
- return false, nil
}
// canReadWorksheet check if the principal can read the worksheet.
@@ -587,9 +587,9 @@ func (s *WorksheetService) canReadWorksheet(ctx context.Context, worksheet *stor
case store.ProjectReadWorkSheet, store.ProjectWriteWorkSheet:
// Check the "bb.worksheets.get" permission in the project.
return s.checkWorksheetPermission(ctx, worksheet.ProjectID, user, iam.PermissionWorksheetsGet)
+ default:
+ return false, nil
}
-
- return false, nil
}
func (s *WorksheetService) checkWorksheetPermission(
@@ -635,6 +635,8 @@ func (s *WorksheetService) convertToAPIWorksheetMessage(ctx context.Context, wor
visibility = v1pb.Worksheet_PROJECT_WRITE
case store.PrivateWorkSheet:
visibility = v1pb.Worksheet_PRIVATE
+ default:
+ // Keep VISIBILITY_UNSPECIFIED
}
creator, err := s.store.GetUserByID(ctx, worksheet.CreatorID)
diff --git a/backend/plugin/advisor/advisor.go b/backend/plugin/advisor/advisor.go
index 74b1ff4db7..fbf95c51e5 100644
--- a/backend/plugin/advisor/advisor.go
+++ b/backend/plugin/advisor/advisor.go
@@ -29,8 +29,9 @@ func NewStatusBySQLReviewRuleLevel(level storepb.SQLReviewRuleLevel) (storepb.Ad
return storepb.Advice_ERROR, nil
case storepb.SQLReviewRuleLevel_WARNING:
return storepb.Advice_WARNING, nil
+ default:
+ return storepb.Advice_STATUS_UNSPECIFIED, errors.Errorf("unexpected rule level type: %s", level)
}
- return storepb.Advice_STATUS_UNSPECIFIED, errors.Errorf("unexpected rule level type: %s", level)
}
// Context is the context for advisor.
diff --git a/backend/plugin/advisor/catalog/walk_through.go b/backend/plugin/advisor/catalog/walk_through.go
index 2abbb81ba1..db929e079f 100644
--- a/backend/plugin/advisor/catalog/walk_through.go
+++ b/backend/plugin/advisor/catalog/walk_through.go
@@ -396,6 +396,8 @@ func (d *DatabaseState) alterDatabase(node *tidbast.AlterDatabaseStmt) *WalkThro
d.characterSet = option.Value
case tidbast.DatabaseOptionCollate:
d.collation = option.Value
+ default:
+ // Other database options
}
}
return nil
@@ -450,6 +452,8 @@ func (d *DatabaseState) createIndex(node *tidbast.CreateIndexStmt) *WalkThroughE
case tidbast.IndexKeyTypeSpatial:
isSpatial = true
tp = SpatialName
+ default:
+ // Other index key types
}
keyList, err := table.validateAndGetKeyStringList(d.ctx, node.IndexPartSpecifications, false /* primary */, isSpatial)
@@ -477,6 +481,8 @@ func (d *DatabaseState) alterTable(node *tidbast.AlterTableStmt) *WalkThroughErr
table.comment = newStringPointer(option.StrValue)
case tidbast.TableOptionEngine:
table.engine = newStringPointer(option.StrValue)
+ default:
+ // Other table options
}
}
case tidbast.AlterTableAddColumns:
@@ -542,6 +548,8 @@ func (d *DatabaseState) alterTable(node *tidbast.AlterTableStmt) *WalkThroughErr
if err := table.changeIndexVisibility(d.ctx, spec.IndexName.O, spec.Visibility); err != nil {
return err
}
+ default:
+ // Other ALTER TABLE types
}
}
@@ -561,6 +569,8 @@ func (t *TableState) changeIndexVisibility(ctx *FinderContext, indexName string,
index.visible = newTruePointer()
case tidbast.IndexVisibilityInvisible:
index.visible = newFalsePointer()
+ default:
+ // Keep current visibility
}
return nil
}
@@ -629,6 +639,8 @@ func (t *TableState) changeColumnDefault(ctx *FinderContext, column *tidbast.Col
// Content comes from MySQL Error content.
Content: fmt.Sprintf("BLOB, TEXT, GEOMETRY or JSON column `%s` can't have a default value", columnName),
}
+ default:
+ // Other column types allow default values
}
}
@@ -932,10 +944,11 @@ func (t *TableState) reorderColumn(position *tidbast.ColumnPosition) (int, *Walk
}
}
return *column.position + 1, nil
- }
- return 0, &WalkThroughError{
- Type: ErrorTypeUnsupported,
- Content: fmt.Sprintf("Unsupported column position type: %d", position.Tp),
+ default:
+ return 0, &WalkThroughError{
+ Type: ErrorTypeUnsupported,
+ Content: fmt.Sprintf("Unsupported column position type: %d", position.Tp),
+ }
}
}
@@ -1100,6 +1113,8 @@ func (t *TableState) createConstraint(ctx *FinderContext, constraint *tidbast.Co
}
case tidbast.ConstraintCheck:
// we do not deal with CHECK constraints
+ default:
+ // Other constraint types
}
return nil
@@ -1158,6 +1173,8 @@ func checkDefault(columnName string, columnType *types.FieldType, value tidbast.
// Content comes from MySQL Error content.
Content: fmt.Sprintf("BLOB, TEXT, GEOMETRY or JSON column `%s` can't have a default value", columnName),
}
+ default:
+ // Other column types allow default values
}
}
@@ -1262,6 +1279,8 @@ func (t *TableState) createColumn(ctx *FinderContext, column *tidbast.ColumnDef,
// we do not deal with STORAGE
case tidbast.ColumnOptionAutoRandom:
// we do not deal with AUTO_RANDOM
+ default:
+ // Other column options
}
}
@@ -1372,6 +1391,8 @@ func getIndexType(option *tidbast.IndexOption) string {
model.IndexTypeHash,
model.IndexTypeRtree:
return option.Tp.String()
+ default:
+ // Other index types
}
}
return model.IndexTypeBtree.String()
diff --git a/backend/plugin/advisor/catalog/walk_through_for_mysql.go b/backend/plugin/advisor/catalog/walk_through_for_mysql.go
index c5a3ad1e28..112aaa8836 100644
--- a/backend/plugin/advisor/catalog/walk_through_for_mysql.go
+++ b/backend/plugin/advisor/catalog/walk_through_for_mysql.go
@@ -446,6 +446,8 @@ func (l *mysqlListener) EnterCreateIndex(ctx *mysql.CreateIndexContext) {
isSpatial = true
tp = SpatialName
case mysql.MySQLParserINDEX_SYMBOL:
+ default:
+ // Other index types
}
if ctx.UNIQUE_SYMBOL() != nil {
unique = true
@@ -499,6 +501,8 @@ func (l *mysqlListener) EnterAlterDatabase(ctx *mysql.AlterDatabaseContext) {
case option.CreateDatabaseOption().DefaultCollation() != nil && option.CreateDatabaseOption().DefaultCollation().CollationName() != nil:
collation := mysqlparser.NormalizeMySQLCollationName(option.CreateDatabaseOption().DefaultCollation().CollationName())
l.databaseState.collation = collation
+ default:
+ // Other options
}
}
}
@@ -663,6 +667,8 @@ func (t *TableState) mysqlChangeIndexVisibility(ctx *FinderContext, indexName st
index.visible = newTruePointer()
case visibility.INVISIBLE_SYMBOL() != nil:
index.visible = newFalsePointer()
+ default:
+ // No visibility specified
}
return nil
}
@@ -698,6 +704,8 @@ func (t *TableState) mysqlAlterColumn(ctx *FinderContext, itemDef mysql.IAlterLi
// Content comes from MySQL Error content.
Content: fmt.Sprintf("BLOB, TEXT, GEOMETRY or JSON column `%s` can't have a default value", columnName),
}
+ default:
+ // Other column types allow default values
}
}
@@ -707,6 +715,8 @@ func (t *TableState) mysqlAlterColumn(ctx *FinderContext, itemDef mysql.IAlterLi
defaultValue = itemDef.ExprWithParentheses().GetText()
case itemDef.SignedLiteral() != nil:
defaultValue = itemDef.SignedLiteral().GetText()
+ default:
+ // No default value expression
}
colState.defaultValue = &defaultValue
@@ -727,6 +737,8 @@ func (t *TableState) mysqlAlterColumn(ctx *FinderContext, itemDef mysql.IAlterLi
case itemDef.DROP_SYMBOL() != nil && itemDef.DEFAULT_SYMBOL() != nil:
// DROP DEFAULT.
colState.defaultValue = nil
+ default:
+ // Other ALTER operations
}
return nil
}
@@ -823,6 +835,8 @@ func positionFromPlaceContext(place mysql.IPlaceContext) *mysqlColumnPosition {
columnPosition.tp = ColumnPositionAfter
columnName := mysqlparser.NormalizeMySQLIdentifier(place.Identifier())
columnPosition.relativeColumn = columnName
+ default:
+ // No position specified
}
}
}
@@ -937,6 +951,8 @@ func (t *TableState) mysqlCreateConstraint(ctx *FinderContext, constraintDef mys
}
case mysql.MySQLParserFOREIGN_SYMBOL:
// we do not deal with FOREIGN KEY constraints.
+ default:
+ // Other constraint types
}
}
@@ -1039,6 +1055,9 @@ func mysqlGetIndexType(tableConstraint mysql.ITableConstraintDefContext) string
case mysql.MySQLParserFULLTEXT_SYMBOL:
return "FULLTEXT"
case mysql.MySQLParserFOREIGN_SYMBOL:
+ // Foreign key - no specific index type
+ default:
+ // Other constraint types
}
// for mysql, we use BTREE as default index type.
return "BTREE"
@@ -1155,6 +1174,8 @@ func (t *TableState) mysqlCreateColumn(ctx *FinderContext, columnName string, fi
// storage.
case mysql.MySQLParserSTORAGE_SYMBOL:
// we do not deal with STORAGE.
+ default:
+ // Other column attributes
}
}
}
@@ -1193,10 +1214,11 @@ func (t *TableState) mysqlReorderColumn(position *mysqlColumnPosition) (int, *Wa
}
}
return *column.position + 1, nil
- }
- return 0, &WalkThroughError{
- Type: ErrorTypeUnsupported,
- Content: fmt.Sprintf("Unsupported column position type: %d", position.tp),
+ default:
+ return 0, &WalkThroughError{
+ Type: ErrorTypeUnsupported,
+ Content: fmt.Sprintf("Unsupported column position type: %d", position.tp),
+ }
}
}
@@ -1360,6 +1382,8 @@ func mysqlCheckDefault(columnName string, fieldDefinition mysql.IFieldDefinition
// Content comes from MySQL Error content.
Content: fmt.Sprintf("BLOB, TEXT, GEOMETRY or JSON column `%s` can't have a default value", columnName),
}
+ default:
+ // Other data types are allowed to have default values
}
return checkDefaultConvert(columnName, fieldDefinition)
diff --git a/backend/plugin/advisor/catalog/walk_through_for_pg.go b/backend/plugin/advisor/catalog/walk_through_for_pg.go
index a9c5b53445..50bc34201d 100644
--- a/backend/plugin/advisor/catalog/walk_through_for_pg.go
+++ b/backend/plugin/advisor/catalog/walk_through_for_pg.go
@@ -791,6 +791,8 @@ func (s *SchemaState) pgCreateColumn(t *TableState, column *ast.ColumnDef, ifNot
// We do not deal with EXCLUSION constraint.
case ast.ConstraintTypeForeign:
// We do not deal with FOREIGN constraint.
+ default:
+ // Other constraint types
}
}
@@ -981,8 +983,9 @@ func getIndexMethod(method ast.IndexMethodType) string {
return "brin"
case ast.IndexMethodTypeIvfflat:
return "ivfflat"
+ default:
+ return ""
}
- return ""
}
func pgKeyListToStringList(keyList []*ast.IndexKeyDef) []string {
@@ -1019,6 +1022,8 @@ func (s *SchemaState) pgGenerateIndexName(createIndex *ast.CreateIndexStmt) (str
}
}
expressionID++
+ default:
+ // Other key types
}
}
if _, err := buf.WriteString("_idx"); err != nil {
diff --git a/backend/plugin/advisor/mssql/rule_column_no_null.go b/backend/plugin/advisor/mssql/rule_column_no_null.go
index c6c1689db4..3b78515eae 100644
--- a/backend/plugin/advisor/mssql/rule_column_no_null.go
+++ b/backend/plugin/advisor/mssql/rule_column_no_null.go
@@ -89,6 +89,7 @@ func (r *ColumnNoNullRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.enterColumnDefinition(ctx.(*parser.Column_definitionContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
@@ -100,6 +101,7 @@ func (r *ColumnNoNullRule) OnExit(ctx antlr.ParserRuleContext, nodeType string)
r.exitCreateTable(ctx.(*parser.Create_tableContext))
case NodeTypeAlterTable:
r.exitAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_naming_table.go b/backend/plugin/advisor/mssql/rule_naming_table.go
index 2b67eb27ca..9286788a53 100644
--- a/backend/plugin/advisor/mssql/rule_naming_table.go
+++ b/backend/plugin/advisor/mssql/rule_naming_table.go
@@ -87,6 +87,7 @@ func (r *NamingTableRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.enterCreateTable(ctx.(*parser.Create_tableContext))
case "Execute_body":
r.enterExecuteBody(ctx.(*parser.Execute_bodyContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_statement_where_disallow_functions_and_calculations.go b/backend/plugin/advisor/mssql/rule_statement_where_disallow_functions_and_calculations.go
index 173a29e89b..a79bc19276 100644
--- a/backend/plugin/advisor/mssql/rule_statement_where_disallow_functions_and_calculations.go
+++ b/backend/plugin/advisor/mssql/rule_statement_where_disallow_functions_and_calculations.go
@@ -103,6 +103,8 @@ func (r *DisallowFuncAndCalculationsRule) OnEnter(ctx antlr.ParserRuleContext, n
r.enterExpression(ctx.(*parser.ExpressionContext))
case "Unary_operator_expression":
r.enterUnaryOperatorExpression(ctx.(*parser.Unary_operator_expressionContext))
+ default:
+ // Ignore other node types
}
return nil
}
@@ -116,6 +118,8 @@ func (r *DisallowFuncAndCalculationsRule) OnExit(ctx antlr.ParserRuleContext, no
r.exitHavingClause(ctx.(*parser.Having_clauseContext))
case NodeTypeSearchCondition:
r.exitSearchCondition(ctx.(*parser.Search_conditionContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_statement_where_requirement_for_update_delete.go b/backend/plugin/advisor/mssql/rule_statement_where_requirement_for_update_delete.go
index 74f102a22f..7369a67b0c 100644
--- a/backend/plugin/advisor/mssql/rule_statement_where_requirement_for_update_delete.go
+++ b/backend/plugin/advisor/mssql/rule_statement_where_requirement_for_update_delete.go
@@ -74,6 +74,8 @@ func (r *WhereRequirementForUpdateDeleteRule) OnEnter(ctx antlr.ParserRuleContex
r.enterDeleteStatement(ctx.(*parser.Delete_statementContext))
case NodeTypeUpdateStatement:
r.enterUpdateStatement(ctx.(*parser.Update_statementContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_table_disallow_ddl.go b/backend/plugin/advisor/mssql/rule_table_disallow_ddl.go
index ccc50c4a4a..0d9bac51fc 100644
--- a/backend/plugin/advisor/mssql/rule_table_disallow_ddl.go
+++ b/backend/plugin/advisor/mssql/rule_table_disallow_ddl.go
@@ -86,6 +86,7 @@ func (r *TableDisallowDDLRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.enterDropTable(ctx.(*parser.Drop_tableContext))
case NodeTypeTruncateTable:
r.enterTruncateTable(ctx.(*parser.Truncate_tableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_table_disallow_dml.go b/backend/plugin/advisor/mssql/rule_table_disallow_dml.go
index e51dcb40db..25eb54bd13 100644
--- a/backend/plugin/advisor/mssql/rule_table_disallow_dml.go
+++ b/backend/plugin/advisor/mssql/rule_table_disallow_dml.go
@@ -88,6 +88,8 @@ func (r *TableDisallowDMLRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.enterUpdateStatement(ctx.(*parser.Update_statementContext))
case "Select_statement_standalone":
r.enterSelectStatementStandalone(ctx.(*parser.Select_statement_standaloneContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_table_no_foreign_key.go b/backend/plugin/advisor/mssql/rule_table_no_foreign_key.go
index 48a8abce7a..95d0ae747f 100644
--- a/backend/plugin/advisor/mssql/rule_table_no_foreign_key.go
+++ b/backend/plugin/advisor/mssql/rule_table_no_foreign_key.go
@@ -96,6 +96,7 @@ func (r *TableNoForeignKeyRule) OnEnter(ctx antlr.ParserRuleContext, nodeType st
r.enterColumnDefTableConstraints(ctx.(*parser.Column_def_table_constraintsContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
@@ -107,6 +108,7 @@ func (r *TableNoForeignKeyRule) OnExit(ctx antlr.ParserRuleContext, nodeType str
r.exitCreateTable(ctx.(*parser.Create_tableContext))
case NodeTypeAlterTable:
r.exitAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mssql/rule_table_require_pk.go b/backend/plugin/advisor/mssql/rule_table_require_pk.go
index e64bc6ce72..867b8ca65d 100644
--- a/backend/plugin/advisor/mssql/rule_table_require_pk.go
+++ b/backend/plugin/advisor/mssql/rule_table_require_pk.go
@@ -108,6 +108,7 @@ func (r *TableRequirePkRule) OnExit(ctx antlr.ParserRuleContext, nodeType string
r.exitCreateTable(ctx.(*parser.Create_tableContext))
case NodeTypeAlterTable:
r.exitAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_charset_allowlist.go b/backend/plugin/advisor/mysql/rule_charset_allowlist.go
index 0c49fd4ecb..235dafdf37 100644
--- a/backend/plugin/advisor/mysql/rule_charset_allowlist.go
+++ b/backend/plugin/advisor/mysql/rule_charset_allowlist.go
@@ -102,6 +102,7 @@ func (r *CharsetAllowlistRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.checkAlterDatabase(ctx.(*mysql.AlterDatabaseContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_collation_allowlist.go b/backend/plugin/advisor/mysql/rule_collation_allowlist.go
index cd4e751f8a..84b3492b72 100644
--- a/backend/plugin/advisor/mysql/rule_collation_allowlist.go
+++ b/backend/plugin/advisor/mysql/rule_collation_allowlist.go
@@ -106,6 +106,7 @@ func (r *CollationAllowlistRule) OnEnter(ctx antlr.ParserRuleContext, nodeType s
r.checkAlterDatabase(ctx.(*mysql.AlterDatabaseContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_auto_increment_initial_value.go b/backend/plugin/advisor/mysql/rule_column_auto_increment_initial_value.go
index e83b75f8ce..c9da999904 100644
--- a/backend/plugin/advisor/mysql/rule_column_auto_increment_initial_value.go
+++ b/backend/plugin/advisor/mysql/rule_column_auto_increment_initial_value.go
@@ -90,6 +90,8 @@ func (r *ColumnAutoIncrementInitialValueRule) OnEnter(ctx antlr.ParserRuleContex
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_auto_increment_must_unsigned.go b/backend/plugin/advisor/mysql/rule_column_auto_increment_must_unsigned.go
index 9e3d824cfb..2ecd621582 100644
--- a/backend/plugin/advisor/mysql/rule_column_auto_increment_must_unsigned.go
+++ b/backend/plugin/advisor/mysql/rule_column_auto_increment_must_unsigned.go
@@ -84,6 +84,7 @@ func (r *ColumnAutoIncrementMustUnsignedRule) OnEnter(ctx antlr.ParserRuleContex
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -144,6 +145,7 @@ func (r *ColumnAutoIncrementMustUnsignedRule) checkAlterTable(ctx *mysql.AlterTa
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
if item.FieldDefinition().DataType() == nil {
@@ -157,6 +159,7 @@ func (r *ColumnAutoIncrementMustUnsignedRule) checkAlterTable(ctx *mysql.AlterTa
}
columnName = mysqlparser.NormalizeMySQLColumnInternalRef(item.ColumnInternalRef())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_column_comment_convention.go b/backend/plugin/advisor/mysql/rule_column_comment_convention.go
index bf53759ab3..c2c0653d1f 100644
--- a/backend/plugin/advisor/mysql/rule_column_comment_convention.go
+++ b/backend/plugin/advisor/mysql/rule_column_comment_convention.go
@@ -90,6 +90,7 @@ func (r *ColumnCommentConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -164,6 +165,7 @@ func (r *ColumnCommentConventionRule) checkAlterTable(ctx *mysql.AlterTableConte
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case item.MODIFY_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.FieldDefinition() != nil:
@@ -173,6 +175,7 @@ func (r *ColumnCommentConventionRule) checkAlterTable(ctx *mysql.AlterTableConte
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
columnName = mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_column_current_time_count_limit.go b/backend/plugin/advisor/mysql/rule_column_current_time_count_limit.go
index 92e9b56f82..ba01ec7ded 100644
--- a/backend/plugin/advisor/mysql/rule_column_current_time_count_limit.go
+++ b/backend/plugin/advisor/mysql/rule_column_current_time_count_limit.go
@@ -101,6 +101,8 @@ func (r *ColumnCurrentTimeCountLimitRule) OnEnter(ctx antlr.ParserRuleContext, n
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
+ // Other node types
}
return nil
}
@@ -168,6 +170,7 @@ func (r *ColumnCurrentTimeCountLimitRule) checkAlterTable(ctx *mysql.AlterTableC
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkTime(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// change column.
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
@@ -219,6 +222,7 @@ func (r *ColumnCurrentTimeCountLimitRule) checkTime(tableName string, _ string,
table.line = r.baseLine + ctx.GetStart().GetLine()
r.tableSet[tableName] = table
}
+ default:
}
}
diff --git a/backend/plugin/advisor/mysql/rule_column_disallow_changing.go b/backend/plugin/advisor/mysql/rule_column_disallow_changing.go
index 49f5221e28..e97ed82d29 100644
--- a/backend/plugin/advisor/mysql/rule_column_disallow_changing.go
+++ b/backend/plugin/advisor/mysql/rule_column_disallow_changing.go
@@ -86,6 +86,7 @@ func (r *ColumnDisallowChangingRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
}
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_disallow_changing_order.go b/backend/plugin/advisor/mysql/rule_column_disallow_changing_order.go
index 2ac977efd9..af2fbd6397 100644
--- a/backend/plugin/advisor/mysql/rule_column_disallow_changing_order.go
+++ b/backend/plugin/advisor/mysql/rule_column_disallow_changing_order.go
@@ -86,6 +86,7 @@ func (r *ColumnDisallowChangingOrderRule) OnEnter(ctx antlr.ParserRuleContext, n
}
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_disallow_changing_type.go b/backend/plugin/advisor/mysql/rule_column_disallow_changing_type.go
index 1f50113bd8..7bfaf86d62 100644
--- a/backend/plugin/advisor/mysql/rule_column_disallow_changing_type.go
+++ b/backend/plugin/advisor/mysql/rule_column_disallow_changing_type.go
@@ -92,6 +92,7 @@ func (r *ColumnDisallowChangingTypeRule) OnEnter(ctx antlr.ParserRuleContext, no
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_disallow_drop_in_index.go b/backend/plugin/advisor/mysql/rule_column_disallow_drop_in_index.go
index a0f1eb070d..917d80da70 100644
--- a/backend/plugin/advisor/mysql/rule_column_disallow_drop_in_index.go
+++ b/backend/plugin/advisor/mysql/rule_column_disallow_drop_in_index.go
@@ -87,6 +87,7 @@ func (r *ColumnDisallowDropInIndexRule) OnEnter(ctx antlr.ParserRuleContext, nod
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_disallow_set_charset.go b/backend/plugin/advisor/mysql/rule_column_disallow_set_charset.go
index f530a04c24..980d03f09e 100644
--- a/backend/plugin/advisor/mysql/rule_column_disallow_set_charset.go
+++ b/backend/plugin/advisor/mysql/rule_column_disallow_set_charset.go
@@ -85,6 +85,8 @@ func (r *ColumnDisallowSetCharsetRule) OnEnter(ctx antlr.ParserRuleContext, node
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
+ // Other node types
}
return nil
}
@@ -180,6 +182,8 @@ func (r *ColumnDisallowSetCharsetRule) checkAlterTable(ctx *mysql.AlterTableCont
charsetName := r.getCharSet(tableElement.ColumnDefinition().FieldDefinition().DataType())
charsetList = append(charsetList, charsetName)
}
+ default:
+ // Other add column formats
}
// change column.
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
diff --git a/backend/plugin/advisor/mysql/rule_column_maximum_character_length.go b/backend/plugin/advisor/mysql/rule_column_maximum_character_length.go
index 1b2d4bb4f1..910b699686 100644
--- a/backend/plugin/advisor/mysql/rule_column_maximum_character_length.go
+++ b/backend/plugin/advisor/mysql/rule_column_maximum_character_length.go
@@ -90,6 +90,7 @@ func (r *ColumnMaximumCharacterLengthRule) OnEnter(ctx antlr.ParserRuleContext,
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -191,6 +192,7 @@ func (r *ColumnMaximumCharacterLengthRule) checkAlterTable(ctx *mysql.AlterTable
charLengthMap[columnName] = charLength
columnList = append(columnList, columnName)
}
+ default:
}
// change column.
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
diff --git a/backend/plugin/advisor/mysql/rule_column_maximum_varchar_length.go b/backend/plugin/advisor/mysql/rule_column_maximum_varchar_length.go
index 2a307a6470..1bfe4aa1b4 100644
--- a/backend/plugin/advisor/mysql/rule_column_maximum_varchar_length.go
+++ b/backend/plugin/advisor/mysql/rule_column_maximum_varchar_length.go
@@ -89,6 +89,7 @@ func (r *VarcharLengthRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -187,6 +188,7 @@ func (r *VarcharLengthRule) checkAlterTable(ctx *mysql.AlterTableContext) {
varcharLengthMap[columnName] = length
columnList = append(columnList, columnName)
}
+ default:
}
// change column.
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
diff --git a/backend/plugin/advisor/mysql/rule_column_no_null.go b/backend/plugin/advisor/mysql/rule_column_no_null.go
index d51b7792f6..43fc9fe9d1 100644
--- a/backend/plugin/advisor/mysql/rule_column_no_null.go
+++ b/backend/plugin/advisor/mysql/rule_column_no_null.go
@@ -101,6 +101,7 @@ func (r *ColumnNoNullRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -215,12 +216,14 @@ func (r *ColumnNoNullRule) checkAlterTable(ctx *mysql.AlterTableContext) {
_, _, column := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
columns = append(columns, column)
}
+ default:
}
// change column
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil:
// only care new column name.
column := mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
columns = append(columns, column)
+ default:
}
for _, column := range columns {
diff --git a/backend/plugin/advisor/mysql/rule_column_require_charset.go b/backend/plugin/advisor/mysql/rule_column_require_charset.go
index e991ae6acc..6a021078c0 100644
--- a/backend/plugin/advisor/mysql/rule_column_require_charset.go
+++ b/backend/plugin/advisor/mysql/rule_column_require_charset.go
@@ -80,6 +80,7 @@ func (r *ColumnRequireCharsetRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_require_collation.go b/backend/plugin/advisor/mysql/rule_column_require_collation.go
index 74889fd3a6..dcc4d5f150 100644
--- a/backend/plugin/advisor/mysql/rule_column_require_collation.go
+++ b/backend/plugin/advisor/mysql/rule_column_require_collation.go
@@ -79,6 +79,7 @@ func (r *ColumnRequireCollationRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_column_require_default.go b/backend/plugin/advisor/mysql/rule_column_require_default.go
index 3ef4d98bc2..d123505b6d 100644
--- a/backend/plugin/advisor/mysql/rule_column_require_default.go
+++ b/backend/plugin/advisor/mysql/rule_column_require_default.go
@@ -82,6 +82,7 @@ func (r *ColumnRequireDefaultRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -155,6 +156,7 @@ func (r *ColumnRequireDefaultRule) checkAlterTable(ctx *mysql.AlterTableContext)
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case item.MODIFY_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.FieldDefinition() != nil:
@@ -164,6 +166,7 @@ func (r *ColumnRequireDefaultRule) checkAlterTable(ctx *mysql.AlterTableContext)
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
columnName = mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
@@ -266,6 +269,7 @@ func (*ColumnRequireDefaultRule) columnNeedDefault(ctx mysql.IFieldDefinitionCon
mysql.MySQLParserPOLYGON_SYMBOL,
mysql.MySQLParserMULTIPOLYGON_SYMBOL:
return false
+ default:
}
return true
}
diff --git a/backend/plugin/advisor/mysql/rule_column_required.go b/backend/plugin/advisor/mysql/rule_column_required.go
index 81e9a9b000..a731e86c2e 100644
--- a/backend/plugin/advisor/mysql/rule_column_required.go
+++ b/backend/plugin/advisor/mysql/rule_column_required.go
@@ -101,6 +101,7 @@ func (r *ColumnRequiredRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.checkDropTable(ctx.(*mysql.DropTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -168,6 +169,7 @@ func (r *ColumnRequiredRule) checkAlterTable(ctx *mysql.AlterTableContext) {
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.addColumn(tableName, columnName)
}
+ default:
}
// drop column
case item.DROP_SYMBOL() != nil && item.ColumnInternalRef() != nil:
@@ -188,6 +190,7 @@ func (r *ColumnRequiredRule) checkAlterTable(ctx *mysql.AlterTableContext) {
if r.renameColumn(tableName, oldColumnName, newColumnName) {
r.line[tableName] = lineNumber
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_column_set_default_for_not_null.go b/backend/plugin/advisor/mysql/rule_column_set_default_for_not_null.go
index 0ec3446dfc..24f3ba69b2 100644
--- a/backend/plugin/advisor/mysql/rule_column_set_default_for_not_null.go
+++ b/backend/plugin/advisor/mysql/rule_column_set_default_for_not_null.go
@@ -83,6 +83,7 @@ func (r *ColumnSetDefaultForNotNullRule) OnEnter(ctx antlr.ParserRuleContext, no
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -177,6 +178,7 @@ func (*ColumnSetDefaultForNotNullRule) canNull(ctx mysql.IFieldDefinitionContext
return false
case attribute.NullLiteral() != nil && attribute.NOT_SYMBOL() == nil:
return true
+ default:
}
}
return true
@@ -229,6 +231,7 @@ func (*ColumnSetDefaultForNotNullRule) columnNeedDefault(ctx mysql.IFieldDefinit
// SERIAL type doesn't need defaults
case mysql.MySQLParserSERIAL_SYMBOL:
return false
+ default:
}
}
@@ -277,6 +280,7 @@ func (r *ColumnSetDefaultForNotNullRule) checkAlterTable(ctx *mysql.AlterTableCo
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case item.MODIFY_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.FieldDefinition() != nil:
@@ -293,6 +297,7 @@ func (r *ColumnSetDefaultForNotNullRule) checkAlterTable(ctx *mysql.AlterTableCo
// only care new column name.
columnName := mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_column_type_disallow_list.go b/backend/plugin/advisor/mysql/rule_column_type_disallow_list.go
index a8b462d046..bc01b41428 100644
--- a/backend/plugin/advisor/mysql/rule_column_type_disallow_list.go
+++ b/backend/plugin/advisor/mysql/rule_column_type_disallow_list.go
@@ -95,6 +95,7 @@ func (r *ColumnTypeDisallowListRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -185,6 +186,7 @@ func (r *ColumnTypeDisallowListRule) checkAlterTable(ctx *mysql.AlterTableContex
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case item.MODIFY_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.FieldDefinition() != nil:
@@ -194,6 +196,7 @@ func (r *ColumnTypeDisallowListRule) checkAlterTable(ctx *mysql.AlterTableContex
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
columnName := mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_disallow_procedure.go b/backend/plugin/advisor/mysql/rule_disallow_procedure.go
index ab47f339f2..d6d3e3ec61 100644
--- a/backend/plugin/advisor/mysql/rule_disallow_procedure.go
+++ b/backend/plugin/advisor/mysql/rule_disallow_procedure.go
@@ -84,6 +84,8 @@ func (r *ProcedureDisallowCreateRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
}
case NodeTypeCreateProcedure:
r.checkCreateProcedure(ctx.(*mysql.CreateProcedureContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_event_disallow_create.go b/backend/plugin/advisor/mysql/rule_event_disallow_create.go
index 132abc35a6..bc29eb1483 100644
--- a/backend/plugin/advisor/mysql/rule_event_disallow_create.go
+++ b/backend/plugin/advisor/mysql/rule_event_disallow_create.go
@@ -84,6 +84,7 @@ func (r *EventDisallowCreateRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
}
case NodeTypeCreateEvent:
r.checkCreateEvent(ctx.(*mysql.CreateEventContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_function_disallow_create.go b/backend/plugin/advisor/mysql/rule_function_disallow_create.go
index 4b90ef2f37..1ee146271f 100644
--- a/backend/plugin/advisor/mysql/rule_function_disallow_create.go
+++ b/backend/plugin/advisor/mysql/rule_function_disallow_create.go
@@ -84,6 +84,7 @@ func (r *FunctionDisallowCreateRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
}
case NodeTypeCreateFunction:
r.checkCreateFunction(ctx.(*mysql.CreateFunctionContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_function_disallowed_list.go b/backend/plugin/advisor/mysql/rule_function_disallowed_list.go
index 83c4adea1e..91cbc4b25f 100644
--- a/backend/plugin/advisor/mysql/rule_function_disallowed_list.go
+++ b/backend/plugin/advisor/mysql/rule_function_disallowed_list.go
@@ -93,6 +93,7 @@ func (r *FunctionDisallowedListRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.checkQuery(ctx.(*mysql.QueryContext))
case NodeTypeFunctionCall:
r.checkFunctionCall(ctx.(*mysql.FunctionCallContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_index_key_number_limit.go b/backend/plugin/advisor/mysql/rule_index_key_number_limit.go
index b620cf1710..b03a4238eb 100644
--- a/backend/plugin/advisor/mysql/rule_index_key_number_limit.go
+++ b/backend/plugin/advisor/mysql/rule_index_key_number_limit.go
@@ -90,6 +90,7 @@ func (r *IndexKeyNumberLimitRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -165,6 +166,7 @@ func (r *IndexKeyNumberLimitRule) checkCreateIndex(ctx *mysql.CreateIndexContext
switch ctx.GetType_().GetTokenType() {
case mysql.MySQLParserFULLTEXT_SYMBOL, mysql.MySQLParserSPATIAL_SYMBOL:
return
+ default:
}
if ctx.CreateIndexTarget() == nil || ctx.CreateIndexTarget().TableRef() == nil || ctx.CreateIndexTarget().KeyListVariants() == nil {
return
diff --git a/backend/plugin/advisor/mysql/rule_index_no_duplicate_column.go b/backend/plugin/advisor/mysql/rule_index_no_duplicate_column.go
index 2207bf5f4f..2b37ba25ea 100644
--- a/backend/plugin/advisor/mysql/rule_index_no_duplicate_column.go
+++ b/backend/plugin/advisor/mysql/rule_index_no_duplicate_column.go
@@ -85,6 +85,7 @@ func (r *IndexNoDuplicateColumnRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
}
return nil
}
@@ -157,6 +158,7 @@ func (r *IndexNoDuplicateColumnRule) checkCreateIndex(ctx *mysql.CreateIndexCont
switch ctx.GetType_().GetTokenType() {
case mysql.MySQLParserFULLTEXT_SYMBOL, mysql.MySQLParserSPATIAL_SYMBOL:
return
+ default:
}
if ctx.CreateIndexTarget() == nil || ctx.CreateIndexTarget().TableRef() == nil || ctx.CreateIndexTarget().KeyListVariants() == nil {
return
diff --git a/backend/plugin/advisor/mysql/rule_index_pk_type.go b/backend/plugin/advisor/mysql/rule_index_pk_type.go
index 9c1211dc67..182e91efc2 100644
--- a/backend/plugin/advisor/mysql/rule_index_pk_type.go
+++ b/backend/plugin/advisor/mysql/rule_index_pk_type.go
@@ -90,6 +90,7 @@ func (r *IndexPkTypeRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -124,6 +125,7 @@ func (r *IndexPkTypeRule) checkCreateTable(ctx *mysql.CreateTableContext) {
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
case tableElement.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, tableElement.TableConstraintDef())
+ default:
}
}
}
@@ -166,6 +168,7 @@ func (r *IndexPkTypeRule) checkAlterTable(ctx *mysql.AlterTableContext) {
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case alterListItem.MODIFY_SYMBOL() != nil && alterListItem.ColumnInternalRef() != nil:
@@ -180,6 +183,7 @@ func (r *IndexPkTypeRule) checkAlterTable(ctx *mysql.AlterTableContext) {
// add constriant.
case alterListItem.ADD_SYMBOL() != nil && alterListItem.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, alterListItem.TableConstraintDef())
+ default:
}
}
}
@@ -253,6 +257,7 @@ func (*IndexPkTypeRule) getIntOrBigIntStr(ctx mysql.IDataTypeContext) string {
case mysql.MySQLParserBIGINT_SYMBOL:
// tp.String() return bigint(20)
return "BIGINT"
+ default:
}
return strings.ToLower(ctx.GetParser().GetTokenStream().GetTextFromRuleContext(ctx))
}
diff --git a/backend/plugin/advisor/mysql/rule_index_primary_key_type_allowlist.go b/backend/plugin/advisor/mysql/rule_index_primary_key_type_allowlist.go
index 7667b65f0b..21eb232ad2 100644
--- a/backend/plugin/advisor/mysql/rule_index_primary_key_type_allowlist.go
+++ b/backend/plugin/advisor/mysql/rule_index_primary_key_type_allowlist.go
@@ -97,6 +97,7 @@ func (r *IndexPrimaryKeyTypeAllowlistRule) OnEnter(ctx antlr.ParserRuleContext,
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -131,6 +132,7 @@ func (r *IndexPrimaryKeyTypeAllowlistRule) checkCreateTable(ctx *mysql.CreateTab
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
case tableElement.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, tableElement.TableConstraintDef())
+ default:
}
}
}
@@ -173,6 +175,7 @@ func (r *IndexPrimaryKeyTypeAllowlistRule) checkAlterTable(ctx *mysql.AlterTable
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case alterListItem.MODIFY_SYMBOL() != nil && alterListItem.ColumnInternalRef() != nil:
@@ -187,6 +190,7 @@ func (r *IndexPrimaryKeyTypeAllowlistRule) checkAlterTable(ctx *mysql.AlterTable
// add constriant.
case alterListItem.ADD_SYMBOL() != nil && alterListItem.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, alterListItem.TableConstraintDef())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_index_total_number_limit.go b/backend/plugin/advisor/mysql/rule_index_total_number_limit.go
index 2232100fb4..d9473244f1 100644
--- a/backend/plugin/advisor/mysql/rule_index_total_number_limit.go
+++ b/backend/plugin/advisor/mysql/rule_index_total_number_limit.go
@@ -96,6 +96,7 @@ func (r *IndexTotalNumberLimitRule) OnEnter(ctx antlr.ParserRuleContext, nodeTyp
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -205,6 +206,7 @@ func (r *IndexTotalNumberLimitRule) checkAlterTable(ctx *mysql.AlterTableContext
// add constraint.
case item.TableConstraintDef() != nil:
r.checkTableConstraintDef(tableName, item.TableConstraintDef())
+ default:
}
// change column.
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil:
@@ -226,6 +228,7 @@ func (r *IndexTotalNumberLimitRule) checkFieldDefinitionContext(tableName string
switch attr.GetValue().GetTokenType() {
case mysql.MySQLParserPRIMARY_SYMBOL, mysql.MySQLParserUNIQUE_SYMBOL:
r.lineForTable[tableName] = r.baseLine + ctx.GetStart().GetLine()
+ default:
}
}
}
@@ -237,5 +240,6 @@ func (r *IndexTotalNumberLimitRule) checkTableConstraintDef(tableName string, ct
switch ctx.GetType_().GetTokenType() {
case mysql.MySQLParserPRIMARY_SYMBOL, mysql.MySQLParserUNIQUE_SYMBOL, mysql.MySQLParserKEY_SYMBOL, mysql.MySQLParserINDEX_SYMBOL, mysql.MySQLParserFULLTEXT_SYMBOL:
r.lineForTable[tableName] = r.baseLine + ctx.GetStart().GetLine()
+ default:
}
}
diff --git a/backend/plugin/advisor/mysql/rule_index_type_no_blob.go b/backend/plugin/advisor/mysql/rule_index_type_no_blob.go
index 1714df60d2..3138debf6b 100644
--- a/backend/plugin/advisor/mysql/rule_index_type_no_blob.go
+++ b/backend/plugin/advisor/mysql/rule_index_type_no_blob.go
@@ -90,6 +90,7 @@ func (r *IndexTypeNoBlobRule) OnEnter(ctx antlr.ParserRuleContext, nodeType stri
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
}
return nil
}
@@ -124,6 +125,7 @@ func (r *IndexTypeNoBlobRule) checkCreateTable(ctx *mysql.CreateTableContext) {
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
case tableElement.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, tableElement.TableConstraintDef())
+ default:
}
}
}
@@ -170,6 +172,7 @@ func (r *IndexTypeNoBlobRule) checkAlterTable(ctx *mysql.AlterTableContext) {
// add constraint.
case alterListItem.TableConstraintDef() != nil:
r.checkConstraintDef(tableName, alterListItem.TableConstraintDef())
+ default:
}
// modify column
case alterListItem.MODIFY_SYMBOL() != nil && alterListItem.ColumnInternalRef() != nil:
@@ -181,6 +184,7 @@ func (r *IndexTypeNoBlobRule) checkAlterTable(ctx *mysql.AlterTableContext) {
r.tablesNewColumns.delete(tableName, oldColumnName)
newColumnName := mysqlparser.NormalizeMySQLIdentifier(alterListItem.Identifier())
r.checkFieldDefinition(tableName, newColumnName, alterListItem.FieldDefinition())
+ default:
}
}
}
@@ -195,6 +199,7 @@ func (r *IndexTypeNoBlobRule) checkCreateIndex(ctx *mysql.CreateIndexContext) {
switch ctx.GetType_().GetTokenType() {
case mysql.MySQLParserFULLTEXT_SYMBOL, mysql.MySQLParserSPATIAL_SYMBOL, mysql.MySQLParserFOREIGN_SYMBOL:
return
+ default:
}
if ctx.CreateIndexTarget() == nil || ctx.CreateIndexTarget().TableRef() == nil || ctx.CreateIndexTarget().KeyListVariants() == nil {
return
diff --git a/backend/plugin/advisor/mysql/rule_insert_disallow_order_by_rand.go b/backend/plugin/advisor/mysql/rule_insert_disallow_order_by_rand.go
index 02a9b91e18..d02c237fa9 100644
--- a/backend/plugin/advisor/mysql/rule_insert_disallow_order_by_rand.go
+++ b/backend/plugin/advisor/mysql/rule_insert_disallow_order_by_rand.go
@@ -101,6 +101,8 @@ func (r *InsertDisallowOrderByRandRule) OnEnter(ctx antlr.ParserRuleContext, nod
}
case NodeTypeQueryExpression:
r.checkQueryExpression(ctx.(*mysql.QueryExpressionContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_insert_must_specify_column.go b/backend/plugin/advisor/mysql/rule_insert_must_specify_column.go
index a111c8e322..e3876a1492 100644
--- a/backend/plugin/advisor/mysql/rule_insert_must_specify_column.go
+++ b/backend/plugin/advisor/mysql/rule_insert_must_specify_column.go
@@ -90,6 +90,8 @@ func (r *InsertMustSpecifyColumnRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
r.checkInsertStatement(ctx.(*mysql.InsertStatementContext))
case NodeTypeSelectItemList:
r.checkSelectItemList(ctx.(*mysql.SelectItemListContext))
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_insert_row_limit.go b/backend/plugin/advisor/mysql/rule_insert_row_limit.go
index 71e5325052..3d6b825882 100644
--- a/backend/plugin/advisor/mysql/rule_insert_row_limit.go
+++ b/backend/plugin/advisor/mysql/rule_insert_row_limit.go
@@ -104,6 +104,7 @@ func (r *InsertRowLimitRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeInsertStatement:
r.checkInsertStatement(ctx.(*mysql.InsertStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_migration_compatibility.go b/backend/plugin/advisor/mysql/rule_migration_compatibility.go
index 3a37b1ed34..b6b6180dc5 100644
--- a/backend/plugin/advisor/mysql/rule_migration_compatibility.go
+++ b/backend/plugin/advisor/mysql/rule_migration_compatibility.go
@@ -101,6 +101,7 @@ func (r *CompatibilityRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
}
return nil
}
@@ -213,6 +214,7 @@ func (r *CompatibilityRule) checkAlterTable(ctx *mysql.AlterTableContext) {
case mysql.MySQLParserFOREIGN_SYMBOL:
r.code = advisor.CompatibilityAddForeignKey
return
+ default:
}
}
diff --git a/backend/plugin/advisor/mysql/rule_naming_auto_increment_column.go b/backend/plugin/advisor/mysql/rule_naming_auto_increment_column.go
index 0300b67570..972390b24b 100644
--- a/backend/plugin/advisor/mysql/rule_naming_auto_increment_column.go
+++ b/backend/plugin/advisor/mysql/rule_naming_auto_increment_column.go
@@ -91,6 +91,7 @@ func (r *NamingAutoIncrementColumnRule) OnEnter(ctx antlr.ParserRuleContext, nod
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -161,6 +162,7 @@ func (r *NamingAutoIncrementColumnRule) checkAlterTable(ctx *mysql.AlterTableCon
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())
}
+ default:
}
// modify column
case item.MODIFY_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.FieldDefinition() != nil:
@@ -170,6 +172,7 @@ func (r *NamingAutoIncrementColumnRule) checkAlterTable(ctx *mysql.AlterTableCon
case item.CHANGE_SYMBOL() != nil && item.ColumnInternalRef() != nil && item.Identifier() != nil && item.FieldDefinition() != nil:
columnName := mysqlparser.NormalizeMySQLIdentifier(item.Identifier())
r.checkFieldDefinition(tableName, columnName, item.FieldDefinition())
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_naming_column.go b/backend/plugin/advisor/mysql/rule_naming_column.go
index e7e88c8618..c4d8634ac9 100644
--- a/backend/plugin/advisor/mysql/rule_naming_column.go
+++ b/backend/plugin/advisor/mysql/rule_naming_column.go
@@ -89,6 +89,7 @@ func (r *NamingColumnRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -162,6 +163,7 @@ func (r *NamingColumnRule) checkAlterTable(ctx *mysql.AlterTableContext) {
_, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())
r.handleColumn(tableName, columnName, tableElement.GetStart().GetLine())
}
+ default:
}
// rename column
case item.RENAME_SYMBOL() != nil && item.COLUMN_SYMBOL() != nil:
diff --git a/backend/plugin/advisor/mysql/rule_naming_foreign_key_convention.go b/backend/plugin/advisor/mysql/rule_naming_foreign_key_convention.go
index 554a5b6f15..3d76498ad3 100644
--- a/backend/plugin/advisor/mysql/rule_naming_foreign_key_convention.go
+++ b/backend/plugin/advisor/mysql/rule_naming_foreign_key_convention.go
@@ -109,6 +109,7 @@ func (r *NamingFKConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeType s
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_naming_identifier_no_keyword.go b/backend/plugin/advisor/mysql/rule_naming_identifier_no_keyword.go
index 5991c6ef16..11577e5a03 100644
--- a/backend/plugin/advisor/mysql/rule_naming_identifier_no_keyword.go
+++ b/backend/plugin/advisor/mysql/rule_naming_identifier_no_keyword.go
@@ -80,6 +80,7 @@ func (r *NamingIdentifierNoKeywordRule) OnEnter(ctx antlr.ParserRuleContext, nod
r.checkPureIdentifier(ctx.(*mysql.PureIdentifierContext))
case NodeTypeIdentifierKeyword:
r.checkIdentifierKeyword(ctx.(*mysql.IdentifierKeywordContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_naming_index_convention.go b/backend/plugin/advisor/mysql/rule_naming_index_convention.go
index 893360cdf9..efba9ee2af 100644
--- a/backend/plugin/advisor/mysql/rule_naming_index_convention.go
+++ b/backend/plugin/advisor/mysql/rule_naming_index_convention.go
@@ -114,6 +114,7 @@ func (r *NamingIndexConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeTyp
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
}
return nil
}
@@ -207,6 +208,7 @@ func (r *NamingIndexConventionRule) checkAlterTable(ctx *mysql.AlterTableContext
line: r.baseLine + ctx.GetStart().GetLine(),
}
indexDataList = append(indexDataList, indexData)
+ default:
}
}
r.handleIndexList(indexDataList)
diff --git a/backend/plugin/advisor/mysql/rule_naming_table.go b/backend/plugin/advisor/mysql/rule_naming_table.go
index 990a274600..5294982f14 100644
--- a/backend/plugin/advisor/mysql/rule_naming_table.go
+++ b/backend/plugin/advisor/mysql/rule_naming_table.go
@@ -93,6 +93,7 @@ func (r *NamingTableRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeRenameTableStatement:
r.checkRenameTableStatement(ctx.(*mysql.RenameTableStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_naming_unique_key_convention.go b/backend/plugin/advisor/mysql/rule_naming_unique_key_convention.go
index 845a690e74..572aa22d14 100644
--- a/backend/plugin/advisor/mysql/rule_naming_unique_key_convention.go
+++ b/backend/plugin/advisor/mysql/rule_naming_unique_key_convention.go
@@ -114,6 +114,8 @@ func (r *NamingUKConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeType s
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
+ // Other node types
}
return nil
}
@@ -211,6 +213,8 @@ func (r *NamingUKConventionRule) checkAlterTable(ctx *mysql.AlterTableContext) {
line: r.baseLine + ctx.GetStart().GetLine(),
}
indexDataList = append(indexDataList, indexData)
+ default:
+ // Other alter operations
}
}
r.handleIndexList(indexDataList)
diff --git a/backend/plugin/advisor/mysql/rule_online_migration.go b/backend/plugin/advisor/mysql/rule_online_migration.go
index 87221b0f27..64166c0612 100644
--- a/backend/plugin/advisor/mysql/rule_online_migration.go
+++ b/backend/plugin/advisor/mysql/rule_online_migration.go
@@ -165,6 +165,7 @@ func (r *OnlineMigrationRule) OnEnter(ctx antlr.ParserRuleContext, nodeType stri
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeAlterTableActions:
r.checkAlterTableActions(ctx.(*mysql.AlterTableActionsContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_add_column_without_position.go b/backend/plugin/advisor/mysql/rule_statement_add_column_without_position.go
index a428adacc9..a00117b82c 100644
--- a/backend/plugin/advisor/mysql/rule_statement_add_column_without_position.go
+++ b/backend/plugin/advisor/mysql/rule_statement_add_column_without_position.go
@@ -132,6 +132,7 @@ func (r *StatementAddColumnWithoutPositionRule) checkAlterTable(ctx *mysql.Alter
break
}
}
+ default:
}
if len(position) != 0 {
diff --git a/backend/plugin/advisor/mysql/rule_statement_affected_row_limit.go b/backend/plugin/advisor/mysql/rule_statement_affected_row_limit.go
index e22e16dd24..abcb3b0990 100644
--- a/backend/plugin/advisor/mysql/rule_statement_affected_row_limit.go
+++ b/backend/plugin/advisor/mysql/rule_statement_affected_row_limit.go
@@ -110,6 +110,7 @@ func (r *StatementAffectedRowLimitRule) OnEnter(ctx antlr.ParserRuleContext, nod
if mysqlparser.IsTopMySQLRule(&ctx.(*mysql.DeleteStatementContext).BaseParserRuleContext) {
r.handleStmt(ctx.GetStart().GetLine())
}
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_dml_dry_run.go b/backend/plugin/advisor/mysql/rule_statement_dml_dry_run.go
index 39508d970b..4f95c8e7bf 100644
--- a/backend/plugin/advisor/mysql/rule_statement_dml_dry_run.go
+++ b/backend/plugin/advisor/mysql/rule_statement_dml_dry_run.go
@@ -113,6 +113,8 @@ func (r *StatementDmlDryRunRule) OnEnter(ctx antlr.ParserRuleContext, nodeType s
if mysqlparser.IsTopMySQLRule(&insertCtx.BaseParserRuleContext) {
r.handleStmt(insertCtx.GetParser().GetTokenStream().GetTextFromRuleContext(insertCtx), insertCtx.GetStart().GetLine())
}
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_join_strict_column_attrs.go b/backend/plugin/advisor/mysql/rule_statement_join_strict_column_attrs.go
index da6c610faf..f42c11387f 100644
--- a/backend/plugin/advisor/mysql/rule_statement_join_strict_column_attrs.go
+++ b/backend/plugin/advisor/mysql/rule_statement_join_strict_column_attrs.go
@@ -114,6 +114,7 @@ func (r *StatementJoinStrictColumnAttrsRule) OnEnter(ctx antlr.ParserRuleContext
r.handleFromClause(ctx.(*mysql.FromClauseContext))
case NodeTypePrimaryExprCompare:
r.handlePrimaryExprCompare(ctx.(*mysql.PrimaryExprCompareContext))
+ default:
}
return nil
}
@@ -127,6 +128,7 @@ func (r *StatementJoinStrictColumnAttrsRule) OnExit(ctx antlr.ParserRuleContext,
}
case NodeTypeFromClause:
r.isInFromClause = false
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_maximum_limit_value.go b/backend/plugin/advisor/mysql/rule_statement_maximum_limit_value.go
index 860e3a790c..840e5ffb80 100644
--- a/backend/plugin/advisor/mysql/rule_statement_maximum_limit_value.go
+++ b/backend/plugin/advisor/mysql/rule_statement_maximum_limit_value.go
@@ -97,6 +97,7 @@ func (r *StatementMaximumLimitValueRule) OnEnter(ctx antlr.ParserRuleContext, no
}
case NodeTypeLimitClause:
r.checkLimitClause(ctx.(*mysql.LimitClauseContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_merge_alter_table.go b/backend/plugin/advisor/mysql/rule_statement_merge_alter_table.go
index 5833ae3f39..2f96889549 100644
--- a/backend/plugin/advisor/mysql/rule_statement_merge_alter_table.go
+++ b/backend/plugin/advisor/mysql/rule_statement_merge_alter_table.go
@@ -102,6 +102,7 @@ func (r *StatementMergeAlterTableRule) OnEnter(ctx antlr.ParserRuleContext, node
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_query_minimum_plan_level.go b/backend/plugin/advisor/mysql/rule_statement_query_minimum_plan_level.go
index ce97bb4e89..d9d94ac858 100644
--- a/backend/plugin/advisor/mysql/rule_statement_query_minimum_plan_level.go
+++ b/backend/plugin/advisor/mysql/rule_statement_query_minimum_plan_level.go
@@ -152,6 +152,8 @@ func (r *StatementQueryMinumumPlanLevelRule) OnEnter(ctx antlr.ParserRuleContext
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeSelectStatement:
r.checkSelectStatement(ctx.(*mysql.SelectStatementContext))
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_where_disallow_using_function.go b/backend/plugin/advisor/mysql/rule_statement_where_disallow_using_function.go
index aad8a5480c..0585d6deef 100644
--- a/backend/plugin/advisor/mysql/rule_statement_where_disallow_using_function.go
+++ b/backend/plugin/advisor/mysql/rule_statement_where_disallow_using_function.go
@@ -89,6 +89,7 @@ func (r *StatementWhereDisallowUsingFunctionRule) OnEnter(ctx antlr.ParserRuleCo
r.inWhereClause = true
case NodeTypeFunctionCall:
r.checkFunctionCall(ctx.(*mysql.FunctionCallContext))
+ default:
}
return nil
}
@@ -100,6 +101,7 @@ func (r *StatementWhereDisallowUsingFunctionRule) OnExit(_ antlr.ParserRuleConte
r.isSelect = false
case NodeTypeWhereClause:
r.inWhereClause = false
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_where_maximum_logical_operator_count.go b/backend/plugin/advisor/mysql/rule_statement_where_maximum_logical_operator_count.go
index 0c8bd49f56..334ebe24be 100644
--- a/backend/plugin/advisor/mysql/rule_statement_where_maximum_logical_operator_count.go
+++ b/backend/plugin/advisor/mysql/rule_statement_where_maximum_logical_operator_count.go
@@ -114,6 +114,7 @@ func (r *StatementWhereMaximumLogicalOperatorCountRule) OnEnter(ctx antlr.Parser
r.checkExprList(ctx.(*mysql.ExprListContext))
case NodeTypeExprOr:
r.checkExprOr(ctx.(*mysql.ExprOrContext))
+ default:
}
return nil
}
@@ -125,6 +126,7 @@ func (r *StatementWhereMaximumLogicalOperatorCountRule) OnExit(_ antlr.ParserRul
r.inPredicateExprIn = false
case NodeTypeExprOr:
r.depth--
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_statement_where_no_equal_null.go b/backend/plugin/advisor/mysql/rule_statement_where_no_equal_null.go
index 53f9cc70c3..51b9c9246f 100644
--- a/backend/plugin/advisor/mysql/rule_statement_where_no_equal_null.go
+++ b/backend/plugin/advisor/mysql/rule_statement_where_no_equal_null.go
@@ -86,6 +86,7 @@ func (r *StatementWhereNoEqualNullRule) OnEnter(ctx antlr.ParserRuleContext, nod
r.isSelect = true
case NodeTypePrimaryExprCompare:
r.checkPrimaryExprCompare(ctx.(*mysql.PrimaryExprCompareContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_disallow_commit.go b/backend/plugin/advisor/mysql/rule_stmt_disallow_commit.go
index 3b31ce1b04..12f2439b75 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_disallow_commit.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_disallow_commit.go
@@ -87,6 +87,7 @@ func (r *StatementDisallowCommitRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeTransactionStatement:
r.checkTransactionStatement(ctx.(*mysql.TransactionStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_disallow_limit.go b/backend/plugin/advisor/mysql/rule_stmt_disallow_limit.go
index 094fd0935f..d084e4db11 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_disallow_limit.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_disallow_limit.go
@@ -93,6 +93,8 @@ func (r *StatementDisallowLimitRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.isInsertStmt = true
case NodeTypeQueryExpression:
r.checkQueryExpression(ctx.(*mysql.QueryExpressionContext))
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_disallow_order_by.go b/backend/plugin/advisor/mysql/rule_stmt_disallow_order_by.go
index a47b23eab0..5bfd760671 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_disallow_order_by.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_disallow_order_by.go
@@ -89,6 +89,7 @@ func (r *DisallowOrderByRule) OnEnter(ctx antlr.ParserRuleContext, nodeType stri
r.checkDeleteStatement(ctx.(*mysql.DeleteStatementContext))
case NodeTypeUpdateStatement:
r.checkUpdateStatement(ctx.(*mysql.UpdateStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_max_execution_time.go b/backend/plugin/advisor/mysql/rule_stmt_max_execution_time.go
index ec2ccd5991..1aff37ca93 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_max_execution_time.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_max_execution_time.go
@@ -98,6 +98,7 @@ func (r *MaxExecutionTimeRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.checkSimpleStatement(ctx.(*mysql.SimpleStatementContext))
case NodeTypeSetStatement:
r.checkSetStatement(ctx.(*mysql.SetStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_no_leading_wildcard_like.go b/backend/plugin/advisor/mysql/rule_stmt_no_leading_wildcard_like.go
index 1799de95e7..d39fcb3ef4 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_no_leading_wildcard_like.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_no_leading_wildcard_like.go
@@ -88,6 +88,7 @@ func (r *NoLeadingWildcardLikeRule) OnEnter(ctx antlr.ParserRuleContext, nodeTyp
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypePredicateExprLike:
r.checkPredicateExprLike(ctx.(*mysql.PredicateExprLikeContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_no_select_all.go b/backend/plugin/advisor/mysql/rule_stmt_no_select_all.go
index 43570a769d..d3592eb414 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_no_select_all.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_no_select_all.go
@@ -87,6 +87,8 @@ func (r *NoSelectAllRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeSelectItemList:
r.checkSelectItemList(ctx.(*mysql.SelectItemListContext))
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_require_algorithm_or_lock_options.go b/backend/plugin/advisor/mysql/rule_stmt_require_algorithm_or_lock_options.go
index b23c74681e..d0ca30eb65 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_require_algorithm_or_lock_options.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_require_algorithm_or_lock_options.go
@@ -95,6 +95,7 @@ func (r *RequireAlgorithmOrLockOptionRule) OnEnter(ctx antlr.ParserRuleContext,
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeAlterTableActions:
r.checkAlterTableActions(ctx.(*mysql.AlterTableActionsContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_where_required.go b/backend/plugin/advisor/mysql/rule_stmt_where_required.go
index dd2a2a91f5..8a4000b11b 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_where_required.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_where_required.go
@@ -91,6 +91,7 @@ func (r *WhereRequirementRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.checkUpdateStatement(ctx.(*mysql.UpdateStatementContext))
case NodeTypeQuerySpecification:
r.checkQuerySpecification(ctx.(*mysql.QuerySpecificationContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_select.go b/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_select.go
index bb7ce46f0e..c1b8561ba8 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_select.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_select.go
@@ -87,6 +87,7 @@ func (r *WhereRequirementForSelectRule) OnEnter(ctx antlr.ParserRuleContext, nod
r.text = queryCtx.GetParser().GetTokenStream().GetTextFromRuleContext(queryCtx)
case NodeTypeQuerySpecification:
r.checkQuerySpecification(ctx.(*mysql.QuerySpecificationContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_update_delete.go b/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_update_delete.go
index d2e5945a47..0b53d34fc8 100644
--- a/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_update_delete.go
+++ b/backend/plugin/advisor/mysql/rule_stmt_where_requirement_for_update_delete.go
@@ -89,6 +89,7 @@ func (r *WhereRequirementForUpdateDeleteRule) OnEnter(ctx antlr.ParserRuleContex
r.checkDeleteStatement(ctx.(*mysql.DeleteStatementContext))
case NodeTypeUpdateStatement:
r.checkUpdateStatement(ctx.(*mysql.UpdateStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_disallow_ddl.go b/backend/plugin/advisor/mysql/rule_table_disallow_ddl.go
index 64bdb56947..f507019c4d 100644
--- a/backend/plugin/advisor/mysql/rule_table_disallow_ddl.go
+++ b/backend/plugin/advisor/mysql/rule_table_disallow_ddl.go
@@ -91,6 +91,7 @@ func (r *TableDisallowDDLRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.checkRenameTableStatement(ctx.(*mysql.RenameTableStatementContext))
case NodeTypeTruncateTableStatement:
r.checkTruncateTableStatement(ctx.(*mysql.TruncateTableStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_disallow_dml.go b/backend/plugin/advisor/mysql/rule_table_disallow_dml.go
index e5574ad6b7..699d540631 100644
--- a/backend/plugin/advisor/mysql/rule_table_disallow_dml.go
+++ b/backend/plugin/advisor/mysql/rule_table_disallow_dml.go
@@ -89,6 +89,7 @@ func (r *TableDisallowDMLRule) OnEnter(ctx antlr.ParserRuleContext, nodeType str
r.checkSelectStatementWithInto(ctx.(*mysql.SelectStatementWithIntoContext))
case NodeTypeUpdateStatement:
r.checkUpdateStatement(ctx.(*mysql.UpdateStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_disallow_partition.go b/backend/plugin/advisor/mysql/rule_table_disallow_partition.go
index 668181e908..fc3258b18b 100644
--- a/backend/plugin/advisor/mysql/rule_table_disallow_partition.go
+++ b/backend/plugin/advisor/mysql/rule_table_disallow_partition.go
@@ -89,6 +89,7 @@ func (r *TableDisallowPartitionRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_disallow_set_charset.go b/backend/plugin/advisor/mysql/rule_table_disallow_set_charset.go
index ee6d614c66..8f0501cba4 100644
--- a/backend/plugin/advisor/mysql/rule_table_disallow_set_charset.go
+++ b/backend/plugin/advisor/mysql/rule_table_disallow_set_charset.go
@@ -86,6 +86,7 @@ func (r *TableDisallowSetCharsetRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
r.checkCreateTable(ctx.(*mysql.CreateTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_limit_size.go b/backend/plugin/advisor/mysql/rule_table_limit_size.go
index 2d17407d18..a07244d76e 100644
--- a/backend/plugin/advisor/mysql/rule_table_limit_size.go
+++ b/backend/plugin/advisor/mysql/rule_table_limit_size.go
@@ -107,6 +107,7 @@ func (r *TableLimitSizeRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.checkTruncateTableStatement(ctx.(*mysql.TruncateTableStatementContext))
case NodeTypeDropTable:
r.checkDropTable(ctx.(*mysql.DropTableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_no_duplicate_index.go b/backend/plugin/advisor/mysql/rule_table_no_duplicate_index.go
index cff1437059..fc9df3fec3 100644
--- a/backend/plugin/advisor/mysql/rule_table_no_duplicate_index.go
+++ b/backend/plugin/advisor/mysql/rule_table_no_duplicate_index.go
@@ -101,6 +101,7 @@ func (r *TableNoDuplicateIndexRule) OnEnter(ctx antlr.ParserRuleContext, nodeTyp
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeCreateIndex:
r.checkCreateIndex(ctx.(*mysql.CreateIndexContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/mysql/rule_table_require_pk.go b/backend/plugin/advisor/mysql/rule_table_require_pk.go
index 2494b98d48..601a7b9a9d 100644
--- a/backend/plugin/advisor/mysql/rule_table_require_pk.go
+++ b/backend/plugin/advisor/mysql/rule_table_require_pk.go
@@ -100,6 +100,7 @@ func (r *TableRequirePKRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.checkDropTable(ctx.(*mysql.DropTableContext))
case NodeTypeAlterTable:
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
+ default:
}
return nil
}
@@ -137,6 +138,7 @@ func (r *TableRequirePKRule) createTable(tableName string, ctx *mysql.CreateTabl
// add primary key from table constraint.
case tableElement.TableConstraintDef() != nil:
r.handleTableConstraintDef(tableName, tableElement.TableConstraintDef())
+ default:
}
}
}
@@ -217,6 +219,7 @@ func (r *TableRequirePKRule) checkAlterTable(ctx *mysql.AlterTableContext) {
if r.dropColumn(tableName, columnName) {
r.line[tableName] = lineNumber
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/mysql/rule_use_innodb.go b/backend/plugin/advisor/mysql/rule_use_innodb.go
index 810fe404d3..5cf304405a 100644
--- a/backend/plugin/advisor/mysql/rule_use_innodb.go
+++ b/backend/plugin/advisor/mysql/rule_use_innodb.go
@@ -88,6 +88,7 @@ func (r *UseInnoDBRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string) er
r.checkAlterTable(ctx.(*mysql.AlterTableContext))
case NodeTypeSetStatement:
r.checkSetStatement(ctx.(*mysql.SetStatementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_column_add_not_null_column_require_default.go b/backend/plugin/advisor/oracle/rule_column_add_not_null_column_require_default.go
index 8d04d6ae1f..185e630386 100644
--- a/backend/plugin/advisor/oracle/rule_column_add_not_null_column_require_default.go
+++ b/backend/plugin/advisor/oracle/rule_column_add_not_null_column_require_default.go
@@ -79,6 +79,7 @@ func (r *ColumnAddNotNullColumnRequireDefaultRule) OnEnter(ctx antlr.ParserRuleC
r.handleColumnDefinitionEnter(ctx.(*parser.Column_definitionContext))
case "Inline_constraint":
r.handleInlineConstraint(ctx.(*parser.Inline_constraintContext))
+ default:
}
return nil
}
@@ -90,6 +91,7 @@ func (r *ColumnAddNotNullColumnRequireDefaultRule) OnExit(ctx antlr.ParserRuleCo
r.handleAlterTableExit()
case "Column_definition":
r.handleColumnDefinitionExit(ctx.(*parser.Column_definitionContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_column_comment_convention.go b/backend/plugin/advisor/oracle/rule_column_comment_convention.go
index 96708778c3..eb2ba8cd62 100644
--- a/backend/plugin/advisor/oracle/rule_column_comment_convention.go
+++ b/backend/plugin/advisor/oracle/rule_column_comment_convention.go
@@ -94,6 +94,7 @@ func (r *ColumnCommentConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeT
r.handleAlterTable(ctx.(*parser.Alter_tableContext))
case "Comment_on_column":
r.handleCommentOnColumn(ctx.(*parser.Comment_on_columnContext))
+ default:
}
return nil
}
@@ -107,6 +108,7 @@ func (r *ColumnCommentConventionRule) OnExit(_ antlr.ParserRuleContext, nodeType
r.handleAddColumnClauseExit()
case "Sql_script":
r.handleSQLScriptExit()
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_index_key_number_limit.go b/backend/plugin/advisor/oracle/rule_index_key_number_limit.go
index 81eb89059f..0792a6bb11 100644
--- a/backend/plugin/advisor/oracle/rule_index_key_number_limit.go
+++ b/backend/plugin/advisor/oracle/rule_index_key_number_limit.go
@@ -85,6 +85,7 @@ func (r *IndexKeyNumberLimitRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.handleTableIndexClause(ctx.(*parser.Table_index_clauseContext))
case "Out_of_line_constraint":
r.handleOutOfLineConstraint(ctx.(*parser.Out_of_line_constraintContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_naming_table.go b/backend/plugin/advisor/oracle/rule_naming_table.go
index 723b36ebfe..ce34bd2a54 100644
--- a/backend/plugin/advisor/oracle/rule_naming_table.go
+++ b/backend/plugin/advisor/oracle/rule_naming_table.go
@@ -84,6 +84,7 @@ func (r *NamingTableRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.handleCreateTable(ctx.(*parser.Create_tableContext))
case "Alter_table_properties":
r.handleAlterTableProperties(ctx.(*parser.Alter_table_propertiesContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_naming_table_no_keyword.go b/backend/plugin/advisor/oracle/rule_naming_table_no_keyword.go
index b42cec5da3..54f71c7ac0 100644
--- a/backend/plugin/advisor/oracle/rule_naming_table_no_keyword.go
+++ b/backend/plugin/advisor/oracle/rule_naming_table_no_keyword.go
@@ -76,6 +76,7 @@ func (r *NamingTableNoKeywordRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.handleCreateTable(ctx.(*parser.Create_tableContext))
case "Alter_table_properties":
r.handleAlterTableProperties(ctx.(*parser.Alter_table_propertiesContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_statement_dml_dry_run.go b/backend/plugin/advisor/oracle/rule_statement_dml_dry_run.go
index 91b37cd4ce..4bd74c7e8c 100644
--- a/backend/plugin/advisor/oracle/rule_statement_dml_dry_run.go
+++ b/backend/plugin/advisor/oracle/rule_statement_dml_dry_run.go
@@ -82,6 +82,7 @@ func (r *StatementDmlDryRunRule) OnEnter(ctx antlr.ParserRuleContext, nodeType s
r.handleDeleteStatement(ctx.(*parser.Delete_statementContext))
case "Merge_statement":
r.handleMergeStatement(ctx.(*parser.Merge_statementContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_table_comment_convention.go b/backend/plugin/advisor/oracle/rule_table_comment_convention.go
index 1cd5737d46..2d92e9dd22 100644
--- a/backend/plugin/advisor/oracle/rule_table_comment_convention.go
+++ b/backend/plugin/advisor/oracle/rule_table_comment_convention.go
@@ -89,6 +89,7 @@ func (r *TableCommentConventionRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.handleCreateTable(ctx.(*parser.Create_tableContext))
case "Comment_on_table":
r.handleCommentOnTable(ctx.(*parser.Comment_on_tableContext))
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_table_no_foreign_key.go b/backend/plugin/advisor/oracle/rule_table_no_foreign_key.go
index f004e280d3..61ab533814 100644
--- a/backend/plugin/advisor/oracle/rule_table_no_foreign_key.go
+++ b/backend/plugin/advisor/oracle/rule_table_no_foreign_key.go
@@ -82,6 +82,7 @@ func (r *TableNoForeignKeyRule) OnEnter(ctx antlr.ParserRuleContext, nodeType st
r.handleReferencesClause(ctx.(*parser.References_clauseContext))
case "Alter_table":
r.handleAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
}
return nil
}
@@ -93,6 +94,7 @@ func (r *TableNoForeignKeyRule) OnExit(_ antlr.ParserRuleContext, nodeType strin
r.tableName = ""
case "Alter_table":
r.tableName = ""
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/oracle/rule_table_require_pk.go b/backend/plugin/advisor/oracle/rule_table_require_pk.go
index 6228221139..7d16b83f83 100644
--- a/backend/plugin/advisor/oracle/rule_table_require_pk.go
+++ b/backend/plugin/advisor/oracle/rule_table_require_pk.go
@@ -90,6 +90,7 @@ func (r *TableRequirePKRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.handleDropTable(ctx.(*parser.Drop_tableContext))
case "Drop_primary_key_or_unique_or_generic_clause":
r.handleDropPrimaryKey(ctx.(*parser.Drop_primary_key_or_unique_or_generic_clauseContext))
+ default:
}
return nil
}
@@ -101,6 +102,7 @@ func (r *TableRequirePKRule) OnExit(_ antlr.ParserRuleContext, nodeType string)
r.tableName = ""
case "Alter_table":
r.tableName = ""
+ default:
}
return nil
}
diff --git a/backend/plugin/advisor/pg/advisor_column_no_null.go b/backend/plugin/advisor/pg/advisor_column_no_null.go
index 32c682cb46..a239ba7c94 100644
--- a/backend/plugin/advisor/pg/advisor_column_no_null.go
+++ b/backend/plugin/advisor/pg/advisor_column_no_null.go
@@ -166,6 +166,8 @@ func (checker *columnNoNullChecker) removeColumnByConstraintList(table *ast.Tabl
for _, expression := range index.ExpressionList() {
checker.removeColumn(table, expression)
}
+ default:
+ // Other constraint types
}
}
}
diff --git a/backend/plugin/advisor/pg/advisor_index_no_duplicate_column.go b/backend/plugin/advisor/pg/advisor_index_no_duplicate_column.go
index b08cdbb27d..22c4a83c3d 100644
--- a/backend/plugin/advisor/pg/advisor_index_no_duplicate_column.go
+++ b/backend/plugin/advisor/pg/advisor_index_no_duplicate_column.go
@@ -155,6 +155,7 @@ func contraintsTypeToString(constrainType ast.ConstraintType) string {
return "UNIQUE KEY"
case ast.ConstraintTypeForeign:
return "FOREIGN KEY"
+ default:
+ return "INDEX"
}
- return "INDEX"
}
diff --git a/backend/plugin/advisor/pg/advisor_migration_compatibility.go b/backend/plugin/advisor/pg/advisor_migration_compatibility.go
index 841f13cd16..edbb4af99f 100644
--- a/backend/plugin/advisor/pg/advisor_migration_compatibility.go
+++ b/backend/plugin/advisor/pg/advisor_migration_compatibility.go
@@ -100,6 +100,8 @@ func (checker *compatibilityChecker) Visit(node ast.Node) ast.Visitor {
if !n.Constraint.SkipValidation {
code = advisor.CompatibilityAddCheck
}
+ default:
+ // Other constraint types
}
}
// ALTER TABLE ALTER COLUMN TYPE
diff --git a/backend/plugin/advisor/pg/advisor_naming_unique_key_convention.go b/backend/plugin/advisor/pg/advisor_naming_unique_key_convention.go
index 54e4fadaf7..7c268d3173 100644
--- a/backend/plugin/advisor/pg/advisor_naming_unique_key_convention.go
+++ b/backend/plugin/advisor/pg/advisor_naming_unique_key_convention.go
@@ -216,6 +216,8 @@ func (checker *namingUKConventionChecker) getUniqueKeyMetadata(schemaName string
metaData: metaData,
}
}
+ default:
+ // Not a unique constraint type
}
return nil
}
diff --git a/backend/plugin/advisor/snowflake/rule_column_no_null.go b/backend/plugin/advisor/snowflake/rule_column_no_null.go
index 031b0b95db..8e3f93a7b2 100644
--- a/backend/plugin/advisor/snowflake/rule_column_no_null.go
+++ b/backend/plugin/advisor/snowflake/rule_column_no_null.go
@@ -92,6 +92,8 @@ func (r *ColumnNoNullRule) OnEnter(ctx antlr.ParserRuleContext, nodeType string)
r.enterAlterTableAlterColumn(ctx.(*parser.Alter_table_alter_columnContext))
case "Alter_column_decl":
r.enterAlterColumnDecl(ctx.(*parser.Alter_column_declContext))
+ default:
+ // Ignore other node types
}
return nil
}
@@ -105,6 +107,8 @@ func (r *ColumnNoNullRule) OnExit(_ antlr.ParserRuleContext, nodeType string) er
r.exitAlterTable()
case "Alter_table_alter_column":
r.exitAlterTableAlterColumn()
+ default:
+ // Ignore other node types
}
return nil
}
diff --git a/backend/plugin/advisor/snowflake/rule_migration_compatibility.go b/backend/plugin/advisor/snowflake/rule_migration_compatibility.go
index aaa46abd6e..612730a3f5 100644
--- a/backend/plugin/advisor/snowflake/rule_migration_compatibility.go
+++ b/backend/plugin/advisor/snowflake/rule_migration_compatibility.go
@@ -100,6 +100,8 @@ func (r *MigrationCompatibilityRule) OnEnter(ctx antlr.ParserRuleContext, nodeTy
r.enterDropDatabase(ctx.(*parser.Drop_databaseContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/snowflake/rule_naming_identifier_case.go b/backend/plugin/advisor/snowflake/rule_naming_identifier_case.go
index 9220b3b95e..139128a84c 100644
--- a/backend/plugin/advisor/snowflake/rule_naming_identifier_case.go
+++ b/backend/plugin/advisor/snowflake/rule_naming_identifier_case.go
@@ -81,6 +81,8 @@ func (r *NamingIdentifierCaseRule) OnEnter(ctx antlr.ParserRuleContext, nodeType
r.enterColumnDeclItemList(ctx.(*parser.Column_decl_item_listContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
+ // Other node types
}
return nil
}
@@ -90,6 +92,8 @@ func (r *NamingIdentifierCaseRule) OnExit(_ antlr.ParserRuleContext, nodeType st
switch nodeType {
case NodeTypeCreateTable, "Create_table_as_select":
r.currentOriginalTableName = ""
+ default:
+ // Other node types
}
return nil
}
diff --git a/backend/plugin/advisor/snowflake/rule_table_no_foreign_key.go b/backend/plugin/advisor/snowflake/rule_table_no_foreign_key.go
index 2e88865b3b..50ffae1c55 100644
--- a/backend/plugin/advisor/snowflake/rule_table_no_foreign_key.go
+++ b/backend/plugin/advisor/snowflake/rule_table_no_foreign_key.go
@@ -99,6 +99,8 @@ func (r *TableNoForeignKeyRule) OnEnter(ctx antlr.ParserRuleContext, nodeType st
r.enterConstraintAction(ctx.(*parser.Constraint_actionContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
+ // Ignore other node types
}
return nil
}
@@ -110,6 +112,8 @@ func (r *TableNoForeignKeyRule) OnExit(_ antlr.ParserRuleContext, nodeType strin
r.exitCreateTable()
case NodeTypeAlterTable:
r.exitAlterTable()
+ default:
+ // Ignore other node types
}
return nil
}
@@ -165,6 +169,8 @@ func (r *TableNoForeignKeyRule) enterOutOfLineConstraint(ctx *parser.Out_of_line
if times, ok := r.tableForeignKeyTimes[r.currentNormalizedTableName]; ok && times > 0 {
r.tableForeignKeyTimes[r.currentNormalizedTableName]--
}
+ default:
+ // Other constraint actions
}
}
diff --git a/backend/plugin/advisor/snowflake/rule_table_require_pk.go b/backend/plugin/advisor/snowflake/rule_table_require_pk.go
index 7df2163375..7151e2aafd 100644
--- a/backend/plugin/advisor/snowflake/rule_table_require_pk.go
+++ b/backend/plugin/advisor/snowflake/rule_table_require_pk.go
@@ -101,6 +101,8 @@ func (r *TableRequirePkRule) OnEnter(ctx antlr.ParserRuleContext, nodeType strin
r.enterConstraintAction(ctx.(*parser.Constraint_actionContext))
case NodeTypeAlterTable:
r.enterAlterTable(ctx.(*parser.Alter_tableContext))
+ default:
+ // Ignore other node types
}
return nil
}
@@ -112,6 +114,8 @@ func (r *TableRequirePkRule) OnExit(_ antlr.ParserRuleContext, nodeType string)
r.exitCreateTable()
case NodeTypeAlterTable:
r.exitAlterTable()
+ default:
+ // Other node types
}
return nil
}
@@ -174,6 +178,8 @@ func (r *TableRequirePkRule) enterOutOfLineConstraint(ctx *parser.Out_of_line_co
case currentConstraintActionDrop:
r.tableHasPrimaryKey[r.currentNormalizedTableName] = false
r.tableLine[r.currentNormalizedTableName] = ctx.GetStart().GetLine()
+ default:
+ // No action for other constraint actions
}
}
diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.go
index 34141b4e11..11c5f7157b 100644
--- a/backend/plugin/advisor/sql_review.go
+++ b/backend/plugin/advisor/sql_review.go
@@ -545,6 +545,8 @@ func SQLReviewCheck(
if err := finder.WalkThrough(asts); err != nil {
return convertWalkThroughErrorToAdvice(err)
}
+ default:
+ // Other database types don't need walkthrough
}
}
@@ -824,6 +826,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeWhereRequirementForSelect, nil
case storepb.Engine_MSSQL:
return MSSQLWhereRequirementForSelect, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleStatementRequireWhereForUpdateDelete:
switch engine {
@@ -837,6 +841,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeWhereRequirementForUpdateDelete, nil
case storepb.Engine_MSSQL:
return MSSQLWhereRequirementForUpdateDelete, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleStatementNoLeadingWildcardLike:
switch engine {
@@ -846,6 +852,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLNoLeadingWildcardLike, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleNoLeadingWildcardLike, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleStatementNoSelectAll:
switch engine {
@@ -859,6 +867,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeNoSelectAll, nil
case storepb.Engine_MSSQL:
return MSSQLNoSelectAll, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleSchemaBackwardCompatibility:
switch engine {
@@ -870,6 +880,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeMigrationCompatibility, nil
case storepb.Engine_MSSQL:
return MSSQLMigrationCompatibility, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleFullyQualifiedObjectName:
if engine == storepb.Engine_POSTGRES {
@@ -887,6 +899,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeNamingTableConvention, nil
case storepb.Engine_MSSQL:
return MSSQLNamingTableConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleIDXNaming:
switch engine {
@@ -894,6 +908,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLNamingIndexConvention, nil
case storepb.Engine_POSTGRES:
return PostgreSQLNamingIndexConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRulePKNaming:
if engine == storepb.Engine_POSTGRES {
@@ -905,6 +921,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLNamingUKConvention, nil
case storepb.Engine_POSTGRES:
return PostgreSQLNamingUKConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleFKNaming:
switch engine {
@@ -912,6 +930,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLNamingFKConvention, nil
case storepb.Engine_POSTGRES:
return PostgreSQLNamingFKConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleColumnNaming:
switch engine {
@@ -919,11 +939,15 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLNamingColumnConvention, nil
case storepb.Engine_POSTGRES:
return PostgreSQLNamingColumnConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleAutoIncrementColumnNaming:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLNamingAutoIncrementColumnConvention, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleTableNameNoKeyword:
switch engine {
@@ -933,6 +957,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeTableNamingNoKeyword, nil
case storepb.Engine_MSSQL:
return MSSQLTableNamingNoKeyword, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleIdentifierNoKeyword:
switch engine {
@@ -944,6 +970,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MSSQLIdentifierNamingNoKeyword, nil
case storepb.Engine_MYSQL:
return MySQLIdentifierNamingNoKeyword, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleIdentifierCase:
switch engine {
@@ -951,6 +979,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return OracleIdentifierCase, nil
case storepb.Engine_SNOWFLAKE:
return SnowflakeIdentifierCase, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleRequiredColumn:
switch engine {
@@ -964,6 +994,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeColumnRequirement, nil
case storepb.Engine_MSSQL:
return MSSQLColumnRequirement, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleColumnNotNull:
switch engine {
@@ -977,6 +1009,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeColumnNoNull, nil
case storepb.Engine_MSSQL:
return MSSQLColumnNoNull, nil
+ default:
+ // Unsupported engine for this rule
}
case SchemaRuleColumnDisallowChangeType:
switch engine {
@@ -984,6 +1018,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLColumnDisallowChangingType, nil
case storepb.Engine_POSTGRES:
return PostgreSQLColumnDisallowChangingType, nil
+ default:
}
case SchemaRuleColumnSetDefaultForNotNull:
switch engine {
@@ -991,16 +1026,19 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLColumnSetDefaultForNotNull, nil
case storepb.Engine_OCEANBASE_ORACLE, storepb.Engine_ORACLE, storepb.Engine_DM:
return OracleAddNotNullColumnRequireDefault, nil
+ default:
}
case SchemaRuleColumnDisallowChange:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLColumnDisallowChanging, nil
+ default:
}
case SchemaRuleColumnDisallowChangingOrder:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLColumnDisallowChangingOrder, nil
+ default:
}
case SchemaRuleColumnDisallowDrop:
if engine == storepb.Engine_OCEANBASE {
@@ -1010,6 +1048,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLColumnDisallowDropInIndex, nil
+ default:
}
case SchemaRuleColumnCommentConvention:
switch engine {
@@ -1019,11 +1058,13 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLColumnCommentConvention, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleColumnCommentConvention, nil
+ default:
}
case SchemaRuleColumnAutoIncrementMustInteger:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLAutoIncrementColumnMustInteger, nil
+ default:
}
case SchemaRuleColumnTypeDisallowList:
switch engine {
@@ -1035,11 +1076,13 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return OracleColumnTypeDisallowList, nil
case storepb.Engine_MSSQL:
return MSSQLColumnTypeDisallowList, nil
+ default:
}
case SchemaRuleColumnDisallowSetCharset:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLDisallowSetColumnCharset, nil
+ default:
}
case SchemaRuleColumnMaximumCharacterLength:
switch engine {
@@ -1049,6 +1092,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLColumnMaximumCharacterLength, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleColumnMaximumCharacterLength, nil
+ default:
}
case SchemaRuleColumnMaximumVarcharLength:
switch engine {
@@ -1060,21 +1104,25 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeColumnMaximumVarcharLength, nil
case storepb.Engine_MSSQL:
return MSSQLColumnMaximumVarcharLength, nil
+ default:
}
case SchemaRuleColumnAutoIncrementInitialValue:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLAutoIncrementColumnInitialValue, nil
+ default:
}
case SchemaRuleColumnAutoIncrementMustUnsigned:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLAutoIncrementColumnMustUnsigned, nil
+ default:
}
case SchemaRuleCurrentTimeColumnCountLimit:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLCurrentTimeColumnCountLimit, nil
+ default:
}
case SchemaRuleColumnRequireDefault:
switch engine {
@@ -1084,6 +1132,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLRequireColumnDefault, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleRequireColumnDefault, nil
+ default:
}
case SchemaRuleColumnDefaultDisallowVolatile:
if engine == storepb.Engine_POSTGRES {
@@ -1113,6 +1162,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeTableRequirePK, nil
case storepb.Engine_MSSQL:
return MSSQLTableRequirePK, nil
+ default:
}
case SchemaRuleTableNoFK:
switch engine {
@@ -1126,6 +1176,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeTableNoFK, nil
case storepb.Engine_MSSQL:
return MSSQLTableNoFK, nil
+ default:
}
case SchemaRuleTableDropNamingConvention:
switch engine {
@@ -1137,6 +1188,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return SnowflakeTableDropNamingConvention, nil
case storepb.Engine_MSSQL:
return MSSQLTableDropNamingConvention, nil
+ default:
}
case SchemaRuleTableCommentConvention:
switch engine {
@@ -1146,6 +1198,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLTableCommentConvention, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleTableCommentConvention, nil
+ default:
}
case SchemaRuleTableDisallowPartition:
switch engine {
@@ -1153,6 +1206,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLTableDisallowPartition, nil
case storepb.Engine_POSTGRES:
return PostgreSQLTableDisallowPartition, nil
+ default:
}
case SchemaRuleTableDisallowTrigger:
if engine == storepb.Engine_MYSQL {
@@ -1176,6 +1230,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLTableDisallowDDL, nil
case storepb.Engine_MSSQL:
return MSSQLTableDisallowDDL, nil
+ default:
}
case SchemaRuleTableDisallowDML:
switch engine {
@@ -1183,6 +1238,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLTableDisallowDML, nil
case storepb.Engine_MSSQL:
return MSSQLTableDisallowDML, nil
+ default:
}
case SchemaRuleTableLimitSize:
if engine == storepb.Engine_MYSQL {
@@ -1200,11 +1256,13 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_MARIADB:
return MySQLUseInnoDB, nil
+ default:
}
case SchemaRuleDropEmptyDatabase:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLDatabaseAllowDropIfEmpty, nil
+ default:
}
case SchemaRuleIndexNoDuplicateColumn:
switch engine {
@@ -1212,6 +1270,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLIndexNoDuplicateColumn, nil
case storepb.Engine_POSTGRES:
return PostgreSQLIndexNoDuplicateColumn, nil
+ default:
}
case SchemaRuleIndexKeyNumberLimit:
switch engine {
@@ -1221,6 +1280,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLIndexKeyNumberLimit, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleIndexKeyNumberLimit, nil
+ default:
}
case SchemaRuleIndexTotalNumberLimit:
switch engine {
@@ -1228,6 +1288,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLIndexTotalNumberLimit, nil
case storepb.Engine_POSTGRES:
return PostgreSQLIndexTotalNumberLimit, nil
+ default:
}
case SchemaRuleIndexNotRedundant:
if engine == storepb.Engine_MSSQL {
@@ -1247,6 +1308,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLStatementDisallowCommit, nil
case storepb.Engine_POSTGRES:
return PostgreSQLStatementDisallowCommit, nil
+ default:
}
case SchemaRuleStatementDisallowUsingFilesort:
if engine == storepb.Engine_MYSQL {
@@ -1266,6 +1328,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return OracleStatementDisallowMixInDDL, nil
case storepb.Engine_MSSQL:
return MSSQLStatementDisallowMixInDDL, nil
+ default:
}
case SchemaRuleStatementDisallowMixInDML:
switch engine {
@@ -1277,6 +1340,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return OracleStatementDisallowMixInDML, nil
case storepb.Engine_MSSQL:
return MSSQLStatementDisallowMixInDML, nil
+ default:
}
case SchemaRuleStatementAddColumnWithoutPosition:
if engine == storepb.Engine_OCEANBASE {
@@ -1288,6 +1352,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLCharsetAllowlist, nil
case storepb.Engine_POSTGRES:
return PostgreSQLEncodingAllowlist, nil
+ default:
}
case SchemaRuleCollationAllowlist:
switch engine {
@@ -1295,16 +1360,19 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLCollationAllowlist, nil
case storepb.Engine_POSTGRES:
return PostgreSQLCollationAllowlist, nil
+ default:
}
case SchemaRuleIndexPKTypeLimit:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLIndexPKType, nil
+ default:
}
case SchemaRuleIndexTypeNoBlob:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLIndexTypeNoBlob, nil
+ default:
}
case SchemaRuleIndexPrimaryKeyTypeAllowlist:
switch engine {
@@ -1312,6 +1380,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLPrimaryKeyTypeAllowlist, nil
case storepb.Engine_POSTGRES:
return PostgreSQLPrimaryKeyTypeAllowlist, nil
+ default:
}
case SchemaRuleCreateIndexConcurrently:
if engine == storepb.Engine_POSTGRES {
@@ -1327,6 +1396,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLInsertRowLimit, nil
case storepb.Engine_POSTGRES:
return PostgreSQLInsertRowLimit, nil
+ default:
}
case SchemaRuleStatementInsertMustSpecifyColumn:
switch engine {
@@ -1336,6 +1406,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLInsertMustSpecifyColumn, nil
case storepb.Engine_ORACLE, storepb.Engine_OCEANBASE_ORACLE:
return OracleInsertMustSpecifyColumn, nil
+ default:
}
case SchemaRuleStatementInsertDisallowOrderByRand:
switch engine {
@@ -1343,16 +1414,19 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLInsertDisallowOrderByRand, nil
case storepb.Engine_POSTGRES:
return PostgreSQLInsertDisallowOrderByRand, nil
+ default:
}
case SchemaRuleStatementDisallowLimit:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLStatementDisallowLimit, nil
+ default:
}
case SchemaRuleStatementDisallowOrderBy:
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLDisallowOrderBy, nil
+ default:
}
case SchemaRuleStatementMergeAlterTable:
switch engine {
@@ -1360,6 +1434,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLMergeAlterTable, nil
case storepb.Engine_POSTGRES:
return PostgreSQLMergeAlterTable, nil
+ default:
}
case SchemaRuleStatementAffectedRowLimit:
switch engine {
@@ -1367,6 +1442,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLStatementAffectedRowLimit, nil
case storepb.Engine_POSTGRES:
return PostgreSQLStatementAffectedRowLimit, nil
+ default:
}
case SchemaRuleStatementDMLDryRun:
switch engine {
@@ -1376,6 +1452,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return PostgreSQLStatementDMLDryRun, nil
case storepb.Engine_ORACLE:
return OracleStatementDMLDryRun, nil
+ default:
}
case SchemaRuleStatementDisallowAddColumnWithDefault:
if engine == storepb.Engine_POSTGRES {
@@ -1397,6 +1474,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
switch engine {
case storepb.Engine_MYSQL, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLStatementSelectFullTableScan, nil
+ default:
}
case SchemaRuleStatementCreateSpecifySchema:
if engine == storepb.Engine_POSTGRES {
@@ -1434,6 +1512,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MySQLStatementMaximumLimitValue, nil
case storepb.Engine_POSTGRES:
return PostgreSQLStatementMaximumLimitValue, nil
+ default:
}
case SchemaRuleStatementMaximumJoinTableCount:
if engine == storepb.Engine_MYSQL {
@@ -1520,7 +1599,11 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
return MSSQLBuiltinPriorBackupCheck, nil
case storepb.Engine_ORACLE:
return OracleBuiltinPriorBackupCheck, nil
+ default:
+ // Unsupported engine for this rule
}
+ default:
+ // Unknown rule type
}
return "", errors.Errorf("unknown SQL review rule type %v for %v", ruleType, engine)
}
diff --git a/backend/plugin/advisor/tidb/advisor_charset_allowlist.go b/backend/plugin/advisor/tidb/advisor_charset_allowlist.go
index a9ac59c0ff..fba6251d5e 100644
--- a/backend/plugin/advisor/tidb/advisor_charset_allowlist.go
+++ b/backend/plugin/advisor/tidb/advisor_charset_allowlist.go
@@ -127,6 +127,7 @@ func (checker *charsetAllowlistChecker) Enter(in ast.Node) (ast.Node, bool) {
code = advisor.DisabledCharset
disabledCharset = charset
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_collation_allowlist.go b/backend/plugin/advisor/tidb/advisor_collation_allowlist.go
index da07abab0c..b32b37f722 100644
--- a/backend/plugin/advisor/tidb/advisor_collation_allowlist.go
+++ b/backend/plugin/advisor/tidb/advisor_collation_allowlist.go
@@ -128,6 +128,8 @@ func (checker *collationAllowlistChecker) Enter(in ast.Node) (ast.Node, bool) {
code = advisor.DisabledCollation
disabledCollation = collation
}
+ default:
+ // Other alter table types
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_auto_increment_must_unsigned.go b/backend/plugin/advisor/tidb/advisor_column_auto_increment_must_unsigned.go
index 1bde03710d..5958f9de70 100644
--- a/backend/plugin/advisor/tidb/advisor_column_auto_increment_must_unsigned.go
+++ b/backend/plugin/advisor/tidb/advisor_column_auto_increment_must_unsigned.go
@@ -96,6 +96,7 @@ func (checker *columnAutoIncrementMustUnsignedChecker) Enter(in ast.Node) (ast.N
line: node.OriginTextPosition(),
})
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_comment_convention.go b/backend/plugin/advisor/tidb/advisor_column_comment_convention.go
index 49499c17dc..42de348ba1 100644
--- a/backend/plugin/advisor/tidb/advisor_column_comment_convention.go
+++ b/backend/plugin/advisor/tidb/advisor_column_comment_convention.go
@@ -116,6 +116,7 @@ func (checker *columnCommentConventionChecker) Enter(in ast.Node) (ast.Node, boo
column: spec.NewColumns[0].Name.Name.O,
line: checker.line,
})
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_current_time_count_limit.go b/backend/plugin/advisor/tidb/advisor_column_current_time_count_limit.go
index 53be1a4603..c00e5699dc 100644
--- a/backend/plugin/advisor/tidb/advisor_column_current_time_count_limit.go
+++ b/backend/plugin/advisor/tidb/advisor_column_current_time_count_limit.go
@@ -140,6 +140,8 @@ func (checker *columnCurrentTimeCountLimitChecker) count(tableName string, colum
table.line = line
checker.tableSet[tableName] = table
}
+ default:
+ // Other column types
}
}
@@ -161,6 +163,7 @@ func (checker *columnCurrentTimeCountLimitChecker) Enter(in ast.Node) (ast.Node,
}
case ast.AlterTableModifyColumn, ast.AlterTableChangeColumn:
checker.count(tableName, spec.NewColumns[0], node.OriginTextPosition())
+ default:
}
}
}
@@ -202,6 +205,7 @@ func isCurrentTime(name string) bool {
// See https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html.
case "current_timestamp", "now", "localtime", "localtimestamp":
return true
+ default:
}
return false
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_disallow_set_charset.go b/backend/plugin/advisor/tidb/advisor_column_disallow_set_charset.go
index 5ef6e6ad3f..c9e705fec5 100644
--- a/backend/plugin/advisor/tidb/advisor_column_disallow_set_charset.go
+++ b/backend/plugin/advisor/tidb/advisor_column_disallow_set_charset.go
@@ -87,6 +87,8 @@ func (checker *columnDisallowSetCharsetChecker) Enter(in ast.Node) (ast.Node, bo
if !checkCharset(charset) {
code = advisor.SetColumnCharset
}
+ default:
+ // Other alter table types
}
if code != advisor.Ok {
break
diff --git a/backend/plugin/advisor/tidb/advisor_column_maximum_character_length.go b/backend/plugin/advisor/tidb/advisor_column_maximum_character_length.go
index f4283ed497..d846cd03fa 100644
--- a/backend/plugin/advisor/tidb/advisor_column_maximum_character_length.go
+++ b/backend/plugin/advisor/tidb/advisor_column_maximum_character_length.go
@@ -101,6 +101,7 @@ func (checker *columnMaximumCharacterLengthChecker) Enter(in ast.Node) (ast.Node
columnName = spec.NewColumns[0].Name.Name.O
line = node.OriginTextPosition()
}
+ default:
}
if tableName != "" {
break
diff --git a/backend/plugin/advisor/tidb/advisor_column_require_default.go b/backend/plugin/advisor/tidb/advisor_column_require_default.go
index 238520b728..012c71ffec 100644
--- a/backend/plugin/advisor/tidb/advisor_column_require_default.go
+++ b/backend/plugin/advisor/tidb/advisor_column_require_default.go
@@ -115,6 +115,7 @@ func (checker *columRequireDefaultChecker) Enter(in ast.Node) (ast.Node, bool) {
line: node.OriginTextPosition(),
})
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_required.go b/backend/plugin/advisor/tidb/advisor_column_required.go
index ff373c966f..18c78b8826 100644
--- a/backend/plugin/advisor/tidb/advisor_column_required.go
+++ b/backend/plugin/advisor/tidb/advisor_column_required.go
@@ -105,6 +105,7 @@ func (v *columnRequirementChecker) Enter(in ast.Node) (ast.Node, bool) {
if v.renameColumn(table, spec.OldColumnName.Name.O, spec.NewColumns[0].Name.Name.O) {
v.line[table] = node.OriginTextPosition()
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go b/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go
index ed6ff7e363..89b854ef44 100644
--- a/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go
+++ b/backend/plugin/advisor/tidb/advisor_column_type_disallow_list.go
@@ -116,6 +116,7 @@ func (checker *columnTypeDisallowListChecker) Enter(in ast.Node) (ast.Node, bool
line: node.OriginTextPosition(),
})
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_index_no_duplicate_column.go b/backend/plugin/advisor/tidb/advisor_index_no_duplicate_column.go
index 01fd76c5d3..682d5d5655 100644
--- a/backend/plugin/advisor/tidb/advisor_index_no_duplicate_column.go
+++ b/backend/plugin/advisor/tidb/advisor_index_no_duplicate_column.go
@@ -120,6 +120,7 @@ func (checker *indexNoDuplicateColumnChecker) Enter(in ast.Node) (ast.Node, bool
line: checker.line,
})
}
+ default:
}
}
}
@@ -167,6 +168,7 @@ func indexTypeString(tp ast.ConstraintType) string {
return "FOREIGN KEY"
case ast.ConstraintIndex:
return "INDEX"
+ default:
}
return "INDEX"
}
diff --git a/backend/plugin/advisor/tidb/advisor_index_pk_type.go b/backend/plugin/advisor/tidb/advisor_index_pk_type.go
index eb3ad110d3..486d94608a 100644
--- a/backend/plugin/advisor/tidb/advisor_index_pk_type.go
+++ b/backend/plugin/advisor/tidb/advisor_index_pk_type.go
@@ -131,6 +131,7 @@ func (v *indexPkTypeChecker) Enter(in ast.Node) (ast.Node, bool) {
}
pds := v.changeColumn(tableName, oldColumnName, node.OriginTextPosition(), newColumnDef)
pkDataList = append(pkDataList, pds...)
+ default:
}
}
}
@@ -238,6 +239,7 @@ func (*indexPkTypeChecker) getIntOrBigIntStr(tp *types.FieldType) string {
case mysql.TypeLonglong:
// tp.String() return bigint(20)
return "BIGINT"
+ default:
}
return tp.String()
}
diff --git a/backend/plugin/advisor/tidb/advisor_index_total_number_limit.go b/backend/plugin/advisor/tidb/advisor_index_total_number_limit.go
index 71f7979f4a..afdb269a86 100644
--- a/backend/plugin/advisor/tidb/advisor_index_total_number_limit.go
+++ b/backend/plugin/advisor/tidb/advisor_index_total_number_limit.go
@@ -134,6 +134,7 @@ func (checker *indexTotalNumberLimitChecker) Enter(in ast.Node) (ast.Node, bool)
if createIndex(spec.NewColumns[0]) {
checker.lineForTable[node.Table.Name.O] = node.OriginTextPosition()
}
+ default:
}
}
case *ast.CreateIndexStmt:
@@ -155,6 +156,7 @@ func createIndex(in ast.Node) bool {
switch option.Tp {
case ast.ColumnOptionPrimaryKey, ast.ColumnOptionUniqKey:
return true
+ default:
}
}
case *ast.Constraint:
@@ -167,6 +169,7 @@ func createIndex(in ast.Node) bool {
ast.ConstraintIndex,
ast.ConstraintFulltext:
return true
+ default:
}
}
return false
diff --git a/backend/plugin/advisor/tidb/advisor_index_type_no_blob.go b/backend/plugin/advisor/tidb/advisor_index_type_no_blob.go
index fc9fb39015..c31bf6933d 100644
--- a/backend/plugin/advisor/tidb/advisor_index_type_no_blob.go
+++ b/backend/plugin/advisor/tidb/advisor_index_type_no_blob.go
@@ -102,6 +102,8 @@ func (v *indexTypeNoBlobChecker) Enter(in ast.Node) (ast.Node, bool) {
}
pds := v.changeColumn(tableName, oldColumnName, node.OriginTextPosition(), newColumnDef)
pkDataList = append(pkDataList, pds...)
+ default:
+ // Other alter table types
}
}
case *ast.CreateIndexStmt:
@@ -240,6 +242,7 @@ func (*indexTypeNoBlobChecker) getBlobStr(tp *types.FieldType) string {
return "mediumblob"
case mysql.TypeLongBlob:
return "longblob"
+ default:
}
return tp.String()
}
diff --git a/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go b/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go
index 367413bb7e..878559cf58 100644
--- a/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go
+++ b/backend/plugin/advisor/tidb/advisor_naming_auto_increment_column.go
@@ -112,6 +112,7 @@ func (checker *namingAutoIncrementColumnChecker) Enter(in ast.Node) (ast.Node, b
line: in.OriginTextPosition(),
})
}
+ default:
}
}
}
diff --git a/backend/plugin/advisor/tidb/advisor_naming_unique_key_convention.go b/backend/plugin/advisor/tidb/advisor_naming_unique_key_convention.go
index f54b32d6df..b66703e6b8 100644
--- a/backend/plugin/advisor/tidb/advisor_naming_unique_key_convention.go
+++ b/backend/plugin/advisor/tidb/advisor_naming_unique_key_convention.go
@@ -134,6 +134,7 @@ func (checker *namingUKConventionChecker) getMetaDataList(in ast.Node) []*indexM
metaData: metaData,
line: constraint.OriginTextPosition(),
})
+ default:
}
}
case *ast.AlterTableStmt:
@@ -179,7 +180,9 @@ func (checker *namingUKConventionChecker) getMetaDataList(in ast.Node) []*indexM
metaData: metaData,
line: in.OriginTextPosition(),
})
+ default:
}
+ default:
}
}
case *ast.CreateIndexStmt:
diff --git a/backend/plugin/advisor/tidb/utils.go b/backend/plugin/advisor/tidb/utils.go
index cc0fe0b71b..678bea4473 100644
--- a/backend/plugin/advisor/tidb/utils.go
+++ b/backend/plugin/advisor/tidb/utils.go
@@ -59,6 +59,8 @@ func needDefault(column *ast.ColumnDef) bool {
switch option.Tp {
case ast.ColumnOptionAutoIncrement, ast.ColumnOptionPrimaryKey, ast.ColumnOptionGenerated:
return false
+ default:
+ // Other options
}
}
@@ -68,6 +70,8 @@ func needDefault(column *ast.ColumnDef) bool {
switch column.Tp.GetType() {
case mysql.TypeJSON, mysql.TypeGeometry:
return false
+ default:
+ // Other types can have default values
}
return true
}
diff --git a/backend/plugin/advisor/utils_for_tests.go b/backend/plugin/advisor/utils_for_tests.go
index 1cf94cede1..d1d833ea8f 100644
--- a/backend/plugin/advisor/utils_for_tests.go
+++ b/backend/plugin/advisor/utils_for_tests.go
@@ -413,6 +413,8 @@ func SetDefaultSQLReviewRulePayload(ruleTp SQLReviewRuleType, dbType storepb.Eng
format = "^[A-Z]+(_[A-Z]+)*$"
case storepb.Engine_MSSQL:
format = "^[A-Z]([_A-Za-z])*$"
+ default:
+ // Use default format for other databases
}
payload, err = json.Marshal(NamingRulePayload{
Format: format,
diff --git a/backend/plugin/db/cockroachdb/cockroachdb.go b/backend/plugin/db/cockroachdb/cockroachdb.go
index ea85c6a20b..2b35712023 100644
--- a/backend/plugin/db/cockroachdb/cockroachdb.go
+++ b/backend/plugin/db/cockroachdb/cockroachdb.go
@@ -306,6 +306,8 @@ func (d *Driver) Execute(ctx context.Context, statement string, opts db.ExecuteO
ct += ";"
}
command.Text = fmt.Sprintf("SET LOCAL ROLE NONE;%sSET LOCAL ROLE '%s';", ct, owner)
+ default:
+ // Regular statements, keep as is
}
tmpCommands = append(tmpCommands, command)
tmpOriginalIndex = append(tmpOriginalIndex, originalIndex[i])
diff --git a/backend/plugin/db/cockroachdb/sync.go b/backend/plugin/db/cockroachdb/sync.go
index 8ab97cd250..9a7bab8e71 100644
--- a/backend/plugin/db/cockroachdb/sync.go
+++ b/backend/plugin/db/cockroachdb/sync.go
@@ -555,6 +555,8 @@ func getTableColumns(txn *sql.Tx) (map[db.TableKey][]*storepb.ColumnMetadata, er
// https://www.postgresql.org/docs/current/infoschema-columns.html.
column.Type = fmt.Sprintf("%s(%s)", column.Type, characterMaxLength.String)
}
+ default:
+ // Keep the type as is
}
column.Collation = collation.String
column.Comment = comment.String
@@ -847,6 +849,8 @@ func getIndexes(txn *sql.Tx) (map[db.TableKey][]*storepb.IndexMetadata, error) {
index.Unique = true
case "UNIQUE":
index.Unique = true
+ default:
+ // Other constraint types
}
}
if comment.Valid {
diff --git a/backend/plugin/db/mongodb/sync.go b/backend/plugin/db/mongodb/sync.go
index c8423e2328..672ab867c3 100644
--- a/backend/plugin/db/mongodb/sync.go
+++ b/backend/plugin/db/mongodb/sync.go
@@ -128,6 +128,8 @@ func (d *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchemaMetad
collectionNames = append(collectionNames, collectionName)
case "view":
viewNames = append(viewNames, collectionName)
+ default:
+ // Other types like system collections
}
}
if err := collectionList.Err(); err != nil {
diff --git a/backend/plugin/db/oracle/sync.go b/backend/plugin/db/oracle/sync.go
index bf7925576c..b1ba39ac97 100644
--- a/backend/plugin/db/oracle/sync.go
+++ b/backend/plugin/db/oracle/sync.go
@@ -1243,6 +1243,8 @@ func getRoutines(txn *sql.Tx, schemaName string) ([]*storepb.FunctionMetadata, [
Name: currentName,
Definition: strings.Join(defText, ""),
})
+ default:
+ // Ignore other types
}
currentName = name
currentType = t
@@ -1270,6 +1272,8 @@ func getRoutines(txn *sql.Tx, schemaName string) ([]*storepb.FunctionMetadata, [
Name: currentName,
Definition: strings.Join(defText, ""),
})
+ default:
+ // Ignore other types
}
if err := rows.Err(); err != nil {
return nil, nil, nil, err
diff --git a/backend/plugin/db/pg/sync.go b/backend/plugin/db/pg/sync.go
index c7a2ef116c..653b26a5c7 100644
--- a/backend/plugin/db/pg/sync.go
+++ b/backend/plugin/db/pg/sync.go
@@ -751,6 +751,8 @@ func getTableColumns(txn *sql.Tx) (map[db.TableKey][]*storepb.ColumnMetadata, er
// https://www.postgresql.org/docs/current/infoschema-columns.html.
column.Type = fmt.Sprintf("%s(%s)", column.Type, characterMaxLength.String)
}
+ default:
+ // Keep the type as is
}
column.Collation = collation.String
column.Comment = comment.String
@@ -760,6 +762,8 @@ func getTableColumns(txn *sql.Tx) (map[db.TableKey][]*storepb.ColumnMetadata, er
column.IdentityGeneration = storepb.ColumnMetadata_ALWAYS
case "BY DEFAULT":
column.IdentityGeneration = storepb.ColumnMetadata_BY_DEFAULT
+ default:
+ // Keep the default value
}
}
diff --git a/backend/plugin/parser/mysql/completion.go b/backend/plugin/parser/mysql/completion.go
index d95fc42f65..b8a84135c2 100644
--- a/backend/plugin/parser/mysql/completion.go
+++ b/backend/plugin/parser/mysql/completion.go
@@ -594,6 +594,8 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
}
viewEntries.insertViews(c, schemas)
}
+ default:
+ // Handle other candidates
}
}
@@ -706,6 +708,8 @@ func (c *Completer) fetchSelectItemAliases(ruleStack []*base.RuleContext) []stri
return result
case mysql.MySQLParserRULE_orderClause, mysql.MySQLParserRULE_groupByClause, mysql.MySQLParserRULE_havingClause:
canUseAliases = true
+ default:
+ // Other cases
}
}
@@ -884,6 +888,8 @@ func (c *Completer) collectRemainingTableReferences() {
if level == 0 {
found = true
}
+ default:
+ // Other tokens, continue scanning
}
}
@@ -929,6 +935,8 @@ func (c *Completer) collectInsertTableReferences(caretIndex int) {
level--
case mysql.MySQLLexerINSERT_SYMBOL, mysql.MySQLLexerINTO_SYMBOL:
found = true
+ default:
+ // Other tokens, continue scanning
}
}
@@ -991,6 +999,8 @@ func (c *Completer) collectLeadingTableReferences(caretIndex int, forTableAlter
c.referencesStack = c.referencesStack[1:]
case mysql.MySQLLexerFROM_SYMBOL:
found = true
+ default:
+ // Other tokens, continue scanning
}
}
diff --git a/backend/plugin/parser/mysql/differ.go b/backend/plugin/parser/mysql/differ.go
index fb27a585c9..94c85c75cb 100644
--- a/backend/plugin/parser/mysql/differ.go
+++ b/backend/plugin/parser/mysql/differ.go
@@ -188,6 +188,8 @@ func (diff *diffNode) diffTableOptions(oldTable, newTable *tableDef) {
// we skip drop them.
case "ENGINE", "DEFAULT COLLATE", "DEFAULT CHARACTER SET":
continue
+ default:
+ // Handle other table options
}
// We should drop the table option if it doesn't exist in the new table options.
if astOption := dropTableOption(oldOption); astOption != nil {
@@ -277,6 +279,8 @@ func dropTableOption(oldOption *tableOptionDef) *tableOptionDef {
case "UNION":
case "ENCRYPTION":
oldOption.alterOption = fmt.Sprintf("ALTER TABLE `%s` ENCRYPTION = 'N';", oldOption.tableName)
+ default:
+ // Other table options not explicitly handled
}
return oldOption
}
@@ -1356,6 +1360,8 @@ func writeAddColumnStatement(buf *strings.Builder, column *columnDef) error {
pos = " FIRST"
case "AFTER":
pos = fmt.Sprintf(" AFTER `%s`", column.columnPosition.relativeColumn)
+ default:
+ // No specific position
}
if _, err := buf.WriteString(pos); err != nil {
return err
@@ -2324,6 +2330,8 @@ func (t *mysqlTransformer) EnterCreateTableOptions(ctx *mysql.CreateTableOptions
newTableOption.option = "ENCRYPTION"
case tableOption.DATA_SYMBOL() != nil && tableOption.DIRECTORY_SYMBOL() != nil:
newTableOption.option = "DATA DIRECTORY"
+ default:
+ // Other table options
}
table := t.db.schemas[""].tables[t.currentTable]
table.tableOptions[newTableOption.option] = newTableOption
@@ -2392,6 +2400,8 @@ func (t *mysqlTransformer) EnterTableConstraintDef(ctx *mysql.TableConstraintDef
tableName: t.currentTable,
}
table.indexConstraints[index.name] = index
+ default:
+ // Other constraint types
}
}
@@ -2758,6 +2768,8 @@ func (t *mysqlTransformer) EnterColumnDefinition(ctx *mysql.ColumnDefinitionCont
}
case attribute.INVISIBLE_SYMBOL() != nil:
columnState.visible = false
+ default:
+ // Other column attributes
}
}
// todo: need handle more types.
@@ -2816,6 +2828,8 @@ func (t *mysqlTransformer) EnterCreateIndex(ctx *mysql.CreateIndexContext) {
index.tp = "FULLTEXT"
case "SPATIAL":
index.tp = "SPATIAL"
+ default:
+ // Other index types
}
}
}
diff --git a/backend/plugin/parser/mysql/normalize.go b/backend/plugin/parser/mysql/normalize.go
index f38def0322..82b3869ff9 100644
--- a/backend/plugin/parser/mysql/normalize.go
+++ b/backend/plugin/parser/mysql/normalize.go
@@ -331,8 +331,9 @@ func NormalizeMySQLCharsetName(ctx parser.ICharsetNameContext) string {
return "DEFAULT"
case ctx.BINARY_SYMBOL() != nil:
return "BINARY"
+ default:
+ return ""
}
- return ""
}
// NormalizeMySQLCollationName noamalizes the given collation name.
@@ -344,8 +345,9 @@ func NormalizeMySQLCollationName(ctx parser.ICollationNameContext) string {
return "DEFAULT"
case ctx.BINARY_SYMBOL() != nil:
return "BINARY"
+ default:
+ return ""
}
- return ""
}
// NormalizeMySQLDataType noamalizes the given dataType.
diff --git a/backend/plugin/parser/mysql/query_span_extractor.go b/backend/plugin/parser/mysql/query_span_extractor.go
index afdac075cd..31edfc9cda 100644
--- a/backend/plugin/parser/mysql/query_span_extractor.go
+++ b/backend/plugin/parser/mysql/query_span_extractor.go
@@ -186,9 +186,9 @@ func (q *querySpanExtractor) extractQueryExpression(ctx parser.IQueryExpressionC
return q.extractQueryExpressionParens(ctx.QueryExpressionParens())
case ctx.QueryExpressionBody() != nil:
return q.extractQueryExpressionBody(ctx.QueryExpressionBody())
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
func (q *querySpanExtractor) extractQueryExpressionParens(ctx parser.IQueryExpressionParensContext) (*base.PseudoTable, error) {
@@ -201,9 +201,9 @@ func (q *querySpanExtractor) extractQueryExpressionParens(ctx parser.IQueryExpre
return q.extractQueryExpression(ctx.QueryExpression())
case ctx.QueryExpressionParens() != nil:
return q.extractQueryExpressionParens(ctx.QueryExpressionParens())
+ default:
+ return nil, nil
}
-
- return nil, nil
}
func (q *querySpanExtractor) extractQueryExpressionBody(ctx parser.IQueryExpressionBodyContext) (*base.PseudoTable, error) {
@@ -281,9 +281,9 @@ func (q *querySpanExtractor) extractQueryPrimary(ctx parser.IQueryPrimaryContext
return q.extractTableValueConstructor(ctx.TableValueConstructor())
case ctx.ExplicitTable() != nil:
return q.extractExplicitTable(ctx.ExplicitTable())
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
func (q *querySpanExtractor) extractExplicitTable(ctx parser.IExplicitTableContext) (base.TableSource, error) {
@@ -428,9 +428,9 @@ func (q *querySpanExtractor) extractSelectItem(ctx parser.ISelectItemContext) ([
IsPlainField: isPlain,
},
}, nil
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
func (q *querySpanExtractor) extractSourceColumnSetFromExpr(ctx antlr.ParserRuleContext) (string, base.SourceColumnSet, bool, error) {
@@ -706,9 +706,9 @@ func joinTableSources(l, r base.TableSource, tp joinType, using []string) base.T
Name: "",
Columns: columns,
}
+ default:
+ return nil
}
-
- return nil
}
func (q *querySpanExtractor) extractTableFactor(ctx parser.ITableFactorContext) (base.TableSource, error) {
@@ -741,9 +741,9 @@ func (q *querySpanExtractor) extractTableFactor(ctx parser.ITableFactorContext)
return result, nil
case ctx.TableFunction() != nil:
return q.extractTableFunction(ctx.TableFunction())
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
func (q *querySpanExtractor) extractTableFunction(ctx parser.ITableFunctionContext) (base.TableSource, error) {
@@ -785,9 +785,9 @@ func (q *querySpanExtractor) extractTableReferenceListParens(ctx parser.ITableRe
return q.extractTableReferenceList(ctx.TableReferenceList())
case ctx.TableReferenceListParens() != nil:
return q.extractTableReferenceListParens(ctx.TableReferenceListParens())
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
func (q *querySpanExtractor) extractSubquery(ctx parser.ISubqueryContext) (*base.PseudoTable, error) {
@@ -863,9 +863,9 @@ func (q *querySpanExtractor) extractSingleTableParens(ctx parser.ISingleTablePar
return q.extractSingleTable(ctx.SingleTable())
case ctx.SingleTableParens() != nil:
return q.extractSingleTableParens(ctx.SingleTableParens())
+ default:
+ panic("unreachable")
}
-
- panic("unreachable")
}
// extractCommonTableExpression extracts the pseudo table from the common table expression.
@@ -1577,9 +1577,9 @@ func extractQueryExpression(ctx parser.IQueryExpressionParensContext) parser.IQu
return ctx.QueryExpression()
case ctx.QueryExpressionParens() != nil:
return extractQueryExpression(ctx.QueryExpressionParens())
+ default:
+ return nil
}
-
- return nil
}
func mysqlExtractJtColumn(ctx parser.IJtColumnContext) []string {
@@ -1592,9 +1592,9 @@ func mysqlExtractJtColumn(ctx parser.IJtColumnContext) []string {
return []string{NormalizeMySQLIdentifier(ctx.Identifier())}
case ctx.ColumnsClause() != nil:
return mysqlExtractColumnsClause(ctx.ColumnsClause())
+ default:
+ return []string{}
}
-
- return []string{}
}
func extractTableRefs(database string, ctx antlr.ParserRuleContext) []base.SchemaResource {
diff --git a/backend/plugin/parser/pg/completion.go b/backend/plugin/parser/pg/completion.go
index cd23f812a7..f0676d2f66 100644
--- a/backend/plugin/parser/pg/completion.go
+++ b/backend/plugin/parser/pg/completion.go
@@ -774,6 +774,8 @@ func (c *Completer) fetchSelectItemAliases(ruleStack []*base.RuleContext) []stri
return result
case pg.PostgreSQLParserRULE_opt_sort_clause, pg.PostgreSQLParserRULE_group_clause, pg.PostgreSQLParserRULE_having_clause:
canUseAliases = true
+ default:
+ // Other cases
}
}
@@ -969,6 +971,8 @@ func (c *Completer) collectRemainingTableReferences() {
if level == 0 {
found = true
}
+ default:
+ // Other tokens, continue scanning
}
}
@@ -1011,6 +1015,8 @@ func (c *Completer) collectLeadingTableReferences(caretIndex int) {
c.referencesStack = c.referencesStack[1:]
case pg.PostgreSQLLexerFROM:
found = true
+ default:
+ // Other tokens, continue scanning
}
}
@@ -1132,6 +1138,8 @@ func (l *TableRefListener) EnterTable_ref(ctx *pg.Table_refContext) {
l.context.referencesStack[0] = append(l.context.referencesStack[0], virtualReference)
}
+ default:
+ // Other cases
}
}
}
diff --git a/backend/plugin/parser/pg/query_span_extractor.go b/backend/plugin/parser/pg/query_span_extractor.go
index 0cd9ca6ffd..c2f02ba0b5 100644
--- a/backend/plugin/parser/pg/query_span_extractor.go
+++ b/backend/plugin/parser/pg/query_span_extractor.go
@@ -2001,6 +2001,8 @@ func pgExtractFieldName(node *pgquery.Node) (string, error) {
return "xmlserialize", nil
case pgquery.XmlExprOp_IS_DOCUMENT:
return pgUnknownFieldName, nil
+ default:
+ return pgUnknownFieldName, nil
}
case *pgquery.Node_TypeCast:
// return the arg name
diff --git a/backend/plugin/parser/pg/split.go b/backend/plugin/parser/pg/split.go
index bbf2274a84..c01fbf3cf7 100644
--- a/backend/plugin/parser/pg/split.go
+++ b/backend/plugin/parser/pg/split.go
@@ -180,6 +180,8 @@ func splitSQLImpl(stream *antlr.CommonTokenStream, statement string) ([]base.Sin
semicolonStack = popSemicolonStack(semicolonStack, beginCaseStack[len(beginCaseStack)-1].pos)
beginCaseStack = beginCaseStack[:len(beginCaseStack)-1]
}
+ default:
+ // Other tokens
}
}
diff --git a/backend/plugin/parser/pg/statement_type.go b/backend/plugin/parser/pg/statement_type.go
index 1e3b5a45dd..14d123c250 100644
--- a/backend/plugin/parser/pg/statement_type.go
+++ b/backend/plugin/parser/pg/statement_type.go
@@ -36,6 +36,8 @@ func getStatementType(node ast.Node) string {
return "CREATE_VIEW"
case ast.TableTypeBaseTable:
return "CREATE_TABLE"
+ default:
+ return "CREATE_TABLE"
}
case *ast.CreateSequenceStmt:
return "CREATE_SEQUENCE"
@@ -91,6 +93,8 @@ func getStatementType(node ast.Node) string {
return "ALTER_VIEW"
case ast.TableTypeBaseTable:
return "ALTER_TABLE"
+ default:
+ return "ALTER_TABLE"
}
case *ast.AlterTypeStmt:
return "ALTER_TYPE"
@@ -115,6 +119,8 @@ func getStatementType(node ast.Node) string {
return "RENAME_VIEW"
case ast.TableTypeBaseTable:
return "RENAME_TABLE"
+ default:
+ return "RENAME_TABLE"
}
case *ast.CommentStmt:
diff --git a/backend/plugin/parser/plsql/completion.go b/backend/plugin/parser/plsql/completion.go
index dc47f8938a..41b895cf89 100644
--- a/backend/plugin/parser/plsql/completion.go
+++ b/backend/plugin/parser/plsql/completion.go
@@ -651,6 +651,8 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
columnEntries.insertColumns(c, schemas, tables)
}
}
+ default:
+ // Handle other candidates
}
}
@@ -763,6 +765,8 @@ func (c *Completer) fetchSelectItemAliases(ruleStack []*base.RuleContext) []stri
}
slices.Sort(result)
return result
+ default:
+ // Other cases
}
}
return nil
@@ -933,6 +937,8 @@ func (c *Completer) collectRemainingTableReferences() {
if level == 0 {
found = true
}
+ default:
+ // Other tokens, continue scanning
}
}
@@ -980,6 +986,8 @@ func (c *Completer) collectLeadingTableReferences(caretIndex int) {
c.referencesStack = c.referencesStack[1:]
case plsql.PlSqlLexerFROM:
found = true
+ default:
+ // Other tokens, continue scanning
}
}
diff --git a/backend/plugin/parser/plsql/differ.go b/backend/plugin/parser/plsql/differ.go
index eb4743326a..5d295df09a 100644
--- a/backend/plugin/parser/plsql/differ.go
+++ b/backend/plugin/parser/plsql/differ.go
@@ -384,8 +384,9 @@ func getConstraintName(ctx plsql.IRelational_propertyContext) string {
}
_, constraintName := NormalizeConstraintName(constraint.Constraint_name())
return constraintName
+ default:
+ return ""
}
- return ""
}
func (diff *diffNode) appendConstraintDiff(tableName string, addConstraints []plsql.IRelational_propertyContext, dropConstraints []string) error {
diff --git a/backend/plugin/parser/plsql/query_type.go b/backend/plugin/parser/plsql/query_type.go
index d5a6a60155..54f06b0b15 100644
--- a/backend/plugin/parser/plsql/query_type.go
+++ b/backend/plugin/parser/plsql/query_type.go
@@ -149,5 +149,7 @@ func (l *queryTypeListener) EnterUnit_statement(ctx *plsql.Unit_statementContext
return
}
l.result = base.DML
+ default:
+ // Other statement types
}
}
diff --git a/backend/plugin/parser/plsql/strings.go b/backend/plugin/parser/plsql/strings.go
index fe5800d9d8..a21a2b44ce 100644
--- a/backend/plugin/parser/plsql/strings.go
+++ b/backend/plugin/parser/plsql/strings.go
@@ -595,6 +595,8 @@ func (r *rewriter) ExitCreate_index(ctx *parser.Create_indexContext) {
r.err = err
return
}
+ default:
+ // Other states
}
}
@@ -702,6 +704,8 @@ func (r *rewriter) ExitCreate_table(ctx *parser.Create_tableContext) {
r.err = err
return
}
+ default:
+ // Other states
}
}
diff --git a/backend/plugin/parser/plsql/strings_test.go b/backend/plugin/parser/plsql/strings_test.go
index 45ba6839ed..fbb5dd6f20 100644
--- a/backend/plugin/parser/plsql/strings_test.go
+++ b/backend/plugin/parser/plsql/strings_test.go
@@ -113,8 +113,9 @@ func convertConstraintTypeForTest(s string) base.TableConstraintType {
return base.TableConstraintTypePrimaryKey
case "unique":
return base.TableConstraintTypeUnique
+ default:
+ return base.TableConstraintTypeNone
}
- return base.TableConstraintTypeNone
}
func convertColumnOptionTypeForTest(s string) base.ColumnOptionType {
@@ -123,6 +124,7 @@ func convertColumnOptionTypeForTest(s string) base.ColumnOptionType {
return base.ColumnOptionTypeNotNull
case "defaultValue":
return base.ColumnOptionTypeDefault
+ default:
+ return base.ColumnOptionTypeNone
}
- return base.ColumnOptionTypeNone
}
diff --git a/backend/plugin/parser/sql/engine/pg/convert.go b/backend/plugin/parser/sql/engine/pg/convert.go
index 5774ae3fa8..c25edf1ce6 100644
--- a/backend/plugin/parser/sql/engine/pg/convert.go
+++ b/backend/plugin/parser/sql/engine/pg/convert.go
@@ -598,6 +598,8 @@ func convert(node *pgquery.Node, statement base.SingleSQL) (res ast.Node, err er
},
},
}, nil
+ default:
+ return nil, NewConvertErrorf("unexpected object type: %q", in.AlterObjectSchemaStmt.ObjectType.String())
}
case *pgquery.Node_ExplainStmt:
explainStmt := &ast.ExplainStmt{}
@@ -708,6 +710,8 @@ func convert(node *pgquery.Node, statement base.SingleSQL) (res ast.Node, err er
default:
return nil, errors.Errorf("expect to get a list node but got %T", node)
}
+ default:
+ return nil, NewConvertErrorf("unexpected comment object type: %q", in.CommentStmt.Objtype.String())
}
return &commentStmt, nil
@@ -1118,8 +1122,9 @@ func convertRoleSpec(in *pgquery.RoleSpec) (*ast.RoleSpec, error) {
Type: ast.RoleSpecTypeSessionUser,
Value: "",
}, nil
+ default:
+ return nil, NewConvertErrorf("unexpected role spec type: %q", in.Roletype.String())
}
- return nil, NewConvertErrorf("unexpected role spec type: %q", in.Roletype.String())
}
func convertNullOrder(order pgquery.SortByNulls) (ast.NullOrderType, error) {
@@ -1245,6 +1250,8 @@ func convertExpressionNode(node *pgquery.Node) (ast.ExpressionNode, []*ast.Patte
}
likeList = append(likeList, like)
return like, likeList, interSubquery, nil
+ default:
+ // Other operators
}
}
return &ast.UnconvertedExpressionDef{}, likeList, subqueryList, nil
@@ -1624,6 +1631,8 @@ func convertConstraint(in *pgquery.Node_Constraint) (*ast.ConstraintDef, error)
}
cons.WhereClause = whereClause
}
+ default:
+ // Other constraint types
}
return cons, nil
@@ -1688,8 +1697,9 @@ func convertConstraintType(in pgquery.ConstrType, usingIndex bool) ast.Constrain
return ast.ConstraintTypeGenerated
case pgquery.ConstrType_CONSTR_NULL:
return ast.ConstraintTypeNull
+ default:
+ return ast.ConstraintTypeUndefined
}
- return ast.ConstraintTypeUndefined
}
func convertColumnDef(in *pgquery.Node_ColumnDef) (*ast.ColumnDef, error) {
@@ -1822,6 +1832,8 @@ func convertDataType(tp *pgquery.TypeName) (ast.DataType, error) {
return &ast.JSON{}
case s == "jsonb":
return &ast.JSON{JSONB: true}
+ default:
+ // Other data types
}
}
return convertToUnconvertedDataType(tp)
diff --git a/backend/plugin/parser/sql/transform/mysql/transform.go b/backend/plugin/parser/sql/transform/mysql/transform.go
index a2dc5e11f7..9b7ab3d494 100644
--- a/backend/plugin/parser/sql/transform/mysql/transform.go
+++ b/backend/plugin/parser/sql/transform/mysql/transform.go
@@ -453,6 +453,8 @@ func (*SchemaTransformer) Check(schema string) (int, error) {
if constraint.Name == "" {
return int(stmt.End.GetLine()), errors.Errorf("The constraint name is required for SDL format")
}
+ default:
+ // Other constraint types
}
}
if node.Partition != nil {
@@ -550,6 +552,8 @@ func (*SchemaTransformer) Transform(schema string) (string, error) {
})
case ast.ConstraintPrimaryKey, ast.ConstraintKey, ast.ConstraintForeignKey, ast.ConstraintFulltext, ast.ConstraintCheck:
constraintList = append(constraintList, constraint)
+ default:
+ // Other constraint types
}
}
node.Constraints = constraintList
diff --git a/backend/plugin/parser/trino/completion.go b/backend/plugin/parser/trino/completion.go
index c03cac0881..57b85659d8 100644
--- a/backend/plugin/parser/trino/completion.go
+++ b/backend/plugin/parser/trino/completion.go
@@ -1672,6 +1672,8 @@ func normalizeQualifiedNameFallback(ctx *trinoparser.QualifiedNameContext, _ str
catalog = parts[0]
schema = parts[1]
table = parts[2]
+ default:
+ // Handle other cases (0 or more than 3 parts)
}
return catalog, schema, table
diff --git a/backend/plugin/parser/tsql/completion.go b/backend/plugin/parser/tsql/completion.go
index f49bcd0cd9..3422adffb1 100644
--- a/backend/plugin/parser/tsql/completion.go
+++ b/backend/plugin/parser/tsql/completion.go
@@ -882,6 +882,8 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
}
}
}
+ default:
+ // Handle other candidates
}
}
@@ -1232,6 +1234,8 @@ func deriveObjectRefContextsFromCandidates(candidates []string, ignoredLinkedSer
if includeColumn {
results = append(results, refCtx.clone().setLinkedServer(candidates[0]).setDatabase(candidates[1]).setSchema(candidates[2]).setObject(candidates[3]).setColumn(candidates[4]))
}
+ default:
+ // Other cases
}
if len(results) == 0 {
@@ -1341,6 +1345,8 @@ func (c *Completer) collectLeadingTableReferences(caretIndex int) {
}
case tsqlparser.TSqlLexerFROM:
found = true
+ default:
+ // Other tokens, continue scanning
}
}
if !found {
@@ -1378,6 +1384,8 @@ func (c *Completer) collectRemainingTableReferences() {
if level == 0 {
found = true
}
+ default:
+ // Other tokens, continue scanning
}
}
@@ -1685,6 +1693,8 @@ func (c *Completer) fetchSelectItemAliases(ruleStack []*base.RuleContext) []stri
return result
case tsqlparser.TSqlParserRULE_group_by_clause, tsqlparser.TSqlParserRULE_order_by_clause, tsqlparser.TSqlParserRULE_having_clause:
canUseAliases = true
+ default:
+ // Other cases
}
}
diff --git a/backend/plugin/schema/mssql/generate_migration.go b/backend/plugin/schema/mssql/generate_migration.go
index c4101a691b..96a3517808 100644
--- a/backend/plugin/schema/mssql/generate_migration.go
+++ b/backend/plugin/schema/mssql/generate_migration.go
@@ -636,6 +636,8 @@ func generateAlterTable(tableDiff *schema.TableDiff) string {
_, _ = buf.WriteString(" CLUSTERED")
case "NONCLUSTERED":
_, _ = buf.WriteString(" NONCLUSTERED")
+ default:
+ // Other index types
}
_, _ = buf.WriteString(" (")
for j, expr := range indexDiff.NewIndex.Expressions {
@@ -866,6 +868,8 @@ func generateCreateIndex(schemaName, tableName string, index *storepb.IndexMetad
_, _ = buf.WriteString(" CLUSTERED")
case "NONCLUSTERED":
_, _ = buf.WriteString(" NONCLUSTERED")
+ default:
+ // Other index types
}
_, _ = buf.WriteString(" INDEX [")
@@ -992,6 +996,8 @@ func generateExtendedPropertySQL(action, objectType, schemaName, objectName, com
_, _ = buf.WriteString("', '")
_, _ = buf.WriteString(objectName)
_, _ = buf.WriteString("'")
+ default:
+ // Other actions
}
return buf.String()
@@ -1050,6 +1056,8 @@ func generateColumnCommentSQL(action, schemaName, tableName, columnName, comment
_, _ = buf.WriteString("', 'COLUMN', '")
_, _ = buf.WriteString(columnName)
_, _ = buf.WriteString("'")
+ default:
+ // Other actions
}
return buf.String()
diff --git a/backend/plugin/schema/mssql/get_database_metadata.go b/backend/plugin/schema/mssql/get_database_metadata.go
index 8ac8729938..4177073172 100644
--- a/backend/plugin/schema/mssql/get_database_metadata.go
+++ b/backend/plugin/schema/mssql/get_database_metadata.go
@@ -917,6 +917,8 @@ func (e *metadataExtractor) extractTableConstraint(ctx parser.ITable_constraintC
fk.OnDelete = "SET NULL"
case onDelete.SET() != nil && onDelete.DEFAULT() != nil:
fk.OnDelete = "SET DEFAULT"
+ default:
+ // Keep the default NO ACTION
}
}
if onUpdate := fkOptions.On_update(0); onUpdate != nil {
@@ -927,6 +929,8 @@ func (e *metadataExtractor) extractTableConstraint(ctx parser.ITable_constraintC
fk.OnDelete = "SET NULL"
case onUpdate.SET() != nil && onUpdate.DEFAULT() != nil:
fk.OnUpdate = "SET DEFAULT"
+ default:
+ // Keep the default NO ACTION
}
}
}
@@ -1242,6 +1246,8 @@ func (e *metadataExtractor) parseExtendedPropertyFromStringArgs(args []string) {
tableName = levelName
case "COLUMN":
columnName = levelName
+ default:
+ // Ignore other level types
}
}
diff --git a/backend/plugin/schema/oracle/generate_migration.go b/backend/plugin/schema/oracle/generate_migration.go
index 9130c9e41f..bbdfe2ed01 100644
--- a/backend/plugin/schema/oracle/generate_migration.go
+++ b/backend/plugin/schema/oracle/generate_migration.go
@@ -1162,6 +1162,8 @@ func writeFunctionDiff(out *strings.Builder, funcDiff *schema.FunctionDiff) {
writeFunctionComment(out, funcDiff.SchemaName, funcDiff.FunctionName, funcDiff.NewFunction.Comment)
}
_, _ = out.WriteString("\n")
+ default:
+ // Handle other actions if needed
}
}
@@ -1298,6 +1300,8 @@ func writeProcedureDiff(out *strings.Builder, procDiff *schema.ProcedureDiff) {
// Note: ProcedureMetadata doesn't have a comment field in the protobuf,
// so we don't add procedure comments here
_, _ = out.WriteString("\n")
+ default:
+ // Handle other actions if needed
}
}
diff --git a/backend/plugin/schema/oracle/get_database_definition.go b/backend/plugin/schema/oracle/get_database_definition.go
index f8a48e65c6..624a81fc59 100644
--- a/backend/plugin/schema/oracle/get_database_definition.go
+++ b/backend/plugin/schema/oracle/get_database_definition.go
@@ -280,6 +280,8 @@ func writeIndex(buf *strings.Builder, table string, index *storepb.IndexMetadata
if _, err := buf.WriteString(` BITMAP`); err != nil {
return err
}
+ default:
+ // Other index types don't need special syntax
}
if index.Unique {
@@ -521,6 +523,8 @@ func writeConstraint(buf *strings.Builder, constraint *storepb.IndexMetadata) er
if _, err := buf.WriteString(`)`); err != nil {
return err
}
+ default:
+ // Other constraint types (e.g. CHECK, FOREIGN KEY)
}
return nil
}
diff --git a/backend/plugin/schema/oracle/get_database_metadata.go b/backend/plugin/schema/oracle/get_database_metadata.go
index 5ae1193452..3956d36fde 100644
--- a/backend/plugin/schema/oracle/get_database_metadata.go
+++ b/backend/plugin/schema/oracle/get_database_metadata.go
@@ -559,6 +559,8 @@ func (e *metadataExtractor) extractRelationalTable(ctx parser.IRelational_tableC
e.extractOutOfLineConstraint(prop.Out_of_line_constraint(), table)
case prop.Out_of_line_ref_constraint() != nil:
e.extractOutOfLineRefConstraint(prop.Out_of_line_ref_constraint(), table)
+ default:
+ // Other relational properties
}
}
}
@@ -660,6 +662,8 @@ func (e *metadataExtractor) extractVirtualColumnDefinition(ctx parser.IVirtual_c
parenCount++
case ')':
parenCount--
+ default:
+ // Other characters
}
i++
}
@@ -776,6 +780,8 @@ func (e *metadataExtractor) extractOutOfLineConstraint(ctx parser.IOut_of_line_c
e.extractUniqueConstraint(ctx, table, constraintName)
case ctx.CHECK() != nil:
e.extractCheckConstraint(ctx, table, constraintName)
+ default:
+ // Other constraint types
}
}
diff --git a/backend/plugin/schema/oracle/get_database_metadata_test.go b/backend/plugin/schema/oracle/get_database_metadata_test.go
index a3a6acae68..a2fbedaadc 100644
--- a/backend/plugin/schema/oracle/get_database_metadata_test.go
+++ b/backend/plugin/schema/oracle/get_database_metadata_test.go
@@ -1113,6 +1113,8 @@ func getColumnExtraInfo(col *storepb.ColumnMetadata) string {
extras = append(extras, "virtual")
case storepb.GenerationMetadata_TYPE_STORED:
extras = append(extras, "stored")
+ default:
+ // Other generation types
}
}
diff --git a/backend/plugin/schema/pg/get_database_definition.go b/backend/plugin/schema/pg/get_database_definition.go
index 6eaf1112e6..828426e84c 100644
--- a/backend/plugin/schema/pg/get_database_definition.go
+++ b/backend/plugin/schema/pg/get_database_definition.go
@@ -1488,6 +1488,8 @@ func writeIndexKeyList(out io.Writer, index *storepb.IndexMetadata) error {
if _, err := io.WriteString(out, " NULLS LAST"); err != nil {
return err
}
+ default:
+ // Default null ordering (no explicit NULLS FIRST/LAST)
}
}
diff --git a/backend/plugin/schema/pg/get_database_metadata.go b/backend/plugin/schema/pg/get_database_metadata.go
index 521f0b21e5..d2e9970fec 100644
--- a/backend/plugin/schema/pg/get_database_metadata.go
+++ b/backend/plugin/schema/pg/get_database_metadata.go
@@ -789,6 +789,8 @@ func (e *metadataExtractor) extractTableConstraint(ctx parser.ITableconstraintCo
table.ForeignKeys = []*storepb.ForeignKeyMetadata{}
}
table.ForeignKeys = append(table.ForeignKeys, fk)
+ default:
+ // Other constraint types not handled
}
}
@@ -1416,6 +1418,8 @@ func (*metadataExtractor) extractSequenceOption(ctx parser.ISeqoptelemContext, s
case ctx.NO() != nil && ctx.CYCLE() != nil:
// NO CYCLE
sequence.Cycle = false
+ default:
+ // Other sequence options
}
}
diff --git a/backend/runner/approval/runner.go b/backend/runner/approval/runner.go
index f1799b1c74..33ea790f29 100644
--- a/backend/runner/approval/runner.go
+++ b/backend/runner/approval/runner.go
@@ -759,6 +759,8 @@ func getRiskSourceFromPlan(config *storepb.PlanConfig) store.RiskSource {
return store.RiskSourceDatabaseSchemaUpdate
case storepb.PlanConfig_ChangeDatabaseConfig_DATA:
return store.RiskSourceDatabaseDataUpdate
+ default:
+ return store.RiskSourceDatabaseSchemaUpdate
}
}
}
@@ -786,6 +788,7 @@ func convertRiskLevel(riskLevel int32) (storepb.IssuePayloadApproval_RiskLevel,
return storepb.IssuePayloadApproval_MODERATE, nil
case 300:
return storepb.IssuePayloadApproval_HIGH, nil
+ default:
+ return storepb.IssuePayloadApproval_RISK_LEVEL_UNSPECIFIED, errors.Errorf("unexpected risk level %d", riskLevel)
}
- return storepb.IssuePayloadApproval_RISK_LEVEL_UNSPECIFIED, errors.Errorf("unexpected risk level %d", riskLevel)
}
diff --git a/backend/runner/plancheck/statement_advise_executor.go b/backend/runner/plancheck/statement_advise_executor.go
index 5e5b6e6ee5..db8635c874 100644
--- a/backend/runner/plancheck/statement_advise_executor.go
+++ b/backend/runner/plancheck/statement_advise_executor.go
@@ -202,6 +202,8 @@ func (e *StatementAdviseExecutor) runReview(
status = storepb.PlanCheckRunResult_Result_WARNING
case storepb.Advice_ERROR:
status = storepb.PlanCheckRunResult_Result_ERROR
+ default:
+ // Other status types
}
results = append(results, &storepb.PlanCheckRunResult_Result{