Skip to content

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

chore: move skipper of comment on extension (#12626)

Danny Xu9db5967bbf08
diff --git a/backend/plugin/db/pg/dump.go b/backend/plugin/db/pg/dump.go
index aa61022e39..acddacca55 100644
--- a/backend/plugin/db/pg/dump.go
+++ b/backend/plugin/db/pg/dump.go
@@ -199,6 +199,13 @@ func (driver *Driver) execPgDump(ctx context.Context, args []string, out io.Writ
if strings.HasPrefix(line, "SET SESSION AUTHORIZATION ") {
return nil
}
+ // Skip "COMMENT ON EXTENSION" till we can support it.
+ // Extensions created in AWS Aurora PostgreSQL are owned by rdsadmin.
+ // We don't have privileges to comment on the extension and have to ignore it.
+ if strings.HasPrefix(line, "COMMENT ON EXTENSION ") {
+ previousLineEmpty = true
+ return nil
+ }
// Skip comment lines.
if strings.HasPrefix(line, "--") {
previousLineComment = true
diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.go
index ff02ffb942..82befb8c10 100644
--- a/backend/plugin/db/pg/pg.go
+++ b/backend/plugin/db/pg/pg.go
@@ -427,9 +427,6 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exe
var nonTransactionAndSetRoleStmts []string
for i, singleSQL := range commands {
- if isIgnoredStatement(singleSQL.Text) {
- continue
- }
if IsNonTransactionStatement(singleSQL.Text) {
nonTransactionAndSetRoleStmts = append(nonTransactionAndSetRoleStmts, singleSQL.Text)
nonTransactionAndSetRoleStmtsIndex = append(nonTransactionAndSetRoleStmtsIndex, i)
@@ -603,13 +600,6 @@ func isSuperuserStatement(stmt string) bool {
return false
}
-func isIgnoredStatement(stmt string) bool {
- // Extensions created in AWS Aurora PostgreSQL are owned by rdsadmin.
- // We don't have privileges to comment on the extension and have to ignore it.
- upperCaseStmt := strings.ToUpper(strings.TrimLeft(stmt, " \n\t"))
- return strings.HasPrefix(upperCaseStmt, "COMMENT ON EXTENSION")
-}
-
var (
// DROP DATABASE cannot run inside a transaction block.
// DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]。