Skip to content

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

chore: register pg fk naming convention for the rule-advisor mapping (#1900)

rebelicee8ad837bc7c0
diff --git a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go b/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
index d7d27c74c5..cd972c7875 100644
--- a/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
+++ b/plugin/advisor/pg/advisor_naming_foreign_key_convention.go
@@ -150,15 +150,8 @@ func (checker *namingFKConventionChecker) getMetaDataList(in ast.Node) []*indexM
// getForeignKeyMetadata returns index metadata of a foreign key constraint, nil if other constraints.
func getForeignKeyMetadata(constraint *ast.ConstraintDef, tableName string) *indexMetaData {
if constraint.Type == ast.ConstraintTypeForeign {
- var referencingColumnList []string
- for _, key := range constraint.KeyList {
- referencingColumnList = append(referencingColumnList, key)
- }
-
- var referencedColumnList []string
- for _, key := range constraint.Foreign.ColumnList {
- referencedColumnList = append(referencedColumnList, key)
- }
+ referencingColumnList := constraint.KeyList
+ referencedColumnList := constraint.Foreign.ColumnList
metaData := map[string]string{
advisor.ReferencingTableNameTemplateToken: tableName,
diff --git a/plugin/advisor/sql_review.go b/plugin/advisor/sql_review.go
index 33f13cfc1d..24e062ef11 100644
--- a/plugin/advisor/sql_review.go
+++ b/plugin/advisor/sql_review.go
@@ -341,6 +341,8 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine DBType) (Type, erro
switch engine {
case MySQL, TiDB:
return MySQLNamingFKConvention, nil
+ case Postgres:
+ return PostgreSQLNamingFKConvention, nil
}
case SchemaRuleColumnNaming:
switch engine {