Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: table doesn't exist error string (#16012)
Danny Xu61c9b261f339
diff --git a/backend/plugin/advisor/catalog/walk_through_for_pg.go b/backend/plugin/advisor/catalog/walk_through_for_pg.goindex 3a9064ab13..e4395287d0 100644--- a/backend/plugin/advisor/catalog/walk_through_for_pg.go+++ b/backend/plugin/advisor/catalog/walk_through_for_pg.go@@ -280,22 +280,17 @@ func (d *DatabaseState) pgRenameIndex(node *ast.RenameIndexStmt) *WalkThroughErr}func (d *DatabaseState) pgAlterTable(node *ast.AlterTableStmt) *WalkThroughError {- // Do nothing for view.- if node.Table.Type == ast.TableTypeView {+ if node.Table.Type != ast.TableTypeBaseTable {return nil}+schema, err := d.getSchema(node.Table.Schema)if err != nil {return err}table, err := schema.pgGetTable(node.Table.Name)if err != nil {- _, err := schema.pgGetView(node.Table.Name)- if err != nil {- return err- }- // Do nothing for view.- return nil+ return err}for _, item := range node.AlterItemList {@@ -1064,23 +1059,12 @@ func (d *DatabaseState) getSchema(schemaName string) (*SchemaState, *WalkThroughreturn schema, nil}-func (s *SchemaState) pgGetView(viewName string) (*ViewState, *WalkThroughError) {- view, exists := s.viewSet[viewName]- if !exists {- return nil, &WalkThroughError{- Type: ErrorTypeViewNotExists,- Content: fmt.Sprintf("The view %q doesn't exists in schema %q", viewName, s.name),- }- }- return view, nil-}-func (s *SchemaState) pgGetTable(tableName string) (*TableState, *WalkThroughError) {table, exists := s.tableSet[tableName]if !exists {return nil, &WalkThroughError{Type: ErrorTypeTableNotExists,- Content: fmt.Sprintf("The table %q doesn't exists in schema %q", tableName, s.name),+ Content: fmt.Sprintf("The table %q does not exist in schema %q", tableName, s.name),}}return table, nil@@ -1104,7 +1088,7 @@ func (t *TableState) getColumn(columnName string) (*ColumnState, *WalkThroughErrif !exists {return nil, &WalkThroughError{Type: ErrorTypeColumnNotExists,- Content: fmt.Sprintf("The column %q doesn't exists in table %q", columnName, t.name),+ Content: fmt.Sprintf("The column %q does not exist in the table %q", columnName, t.name),}}return column, nil