Skip to content

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

fix(plugin/schema/pg): bump omni for COMMENT ON EXTENSION + unique-index FK fixes (#19885)

h3n4ld8c955a92fa5
diff --git a/backend/plugin/schema/pg/sdl_migration_omni.go b/backend/plugin/schema/pg/sdl_migration_omni.go
index 3156aa3a32..b6cadeab9e 100644
--- a/backend/plugin/schema/pg/sdl_migration_omni.go
+++ b/backend/plugin/schema/pg/sdl_migration_omni.go
@@ -2,7 +2,6 @@ package pg
import (
"fmt"
- "strings"
"github.com/pkg/errors"
@@ -21,19 +20,21 @@ func init() {
schema.RegisterSDLDropAdvices(storepb.Engine_COCKROACHDB, pgSDLDropAdvices)
}
-// loadCatalog loads a schema text into a catalog. It tries LoadSDL first
-// (declarative CREATE/COMMENT/GRANT only). If that fails (e.g. raw dump with
-// SET/SELECT), it falls back to LoadSQL which accepts any SQL.
+// loadCatalog parses a schema text and returns a catalog reflecting it.
+// LoadSDL is the canonical, dependency-aware path. LoadSQL is tried only as
+// a fallback for raw dumps containing non-SDL statements (e.g. SET, SELECT)
+// that LoadSDL legitimately rejects. When both fail, the LoadSDL error is
+// returned because it is far more diagnostic than LoadSQL's order-dependent
+// failures (e.g. "relation X does not exist" on a forward FK reference).
func loadCatalog(text string) (*catalog.Catalog, error) {
- text = strings.TrimSpace(text)
- if text == "" {
- return catalog.LoadSDL("")
+ c, sdlErr := catalog.LoadSDL(text)
+ if sdlErr == nil {
+ return c, nil
}
- c, err := catalog.LoadSDL(text)
- if err != nil {
- return catalog.LoadSQL(text)
+ if c, err := catalog.LoadSQL(text); err == nil {
+ return c, nil
}
- return c, nil
+ return nil, sdlErr
}
// buildMigrationPlan loads two schema texts into catalogs, diffs them, and
diff --git a/go.mod b/go.mod
index 2be88a610c..a1551d35e8 100644
--- a/go.mod
+++ b/go.mod
@@ -34,7 +34,7 @@ require (
github.com/bmatcuk/doublestar/v4 v4.10.0
github.com/bytebase/gomongo v0.0.0-20260403033636-f6c50d4ab888
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0
- github.com/bytebase/omni v0.0.0-20260403104830-b57a2edb14b0
+ github.com/bytebase/omni v0.0.0-20260407105220-3c81c575ccb5
github.com/caarlos0/env/v11 v11.4.0
github.com/cenkalti/backoff/v5 v5.0.3
github.com/cockroachdb/cockroachdb-parser v0.25.2
diff --git a/go.sum b/go.sum
index 24d10ee3ca..c2767bcd69 100644
--- a/go.sum
+++ b/go.sum
@@ -253,8 +253,8 @@ github.com/bytebase/gomongo v0.0.0-20260403033636-f6c50d4ab888 h1:E8tz8maxpih/vt
github.com/bytebase/gomongo v0.0.0-20260403033636-f6c50d4ab888/go.mod h1:IgLUOjyiHehdE0G3C92IjGYu9lJQgkPwf2mdNSvPWq8=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0 h1:bJ8NSf2K+pccl5m/wuu97fiYjDwpJH6IzURAq/3XA2U=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0/go.mod h1:BEWMfiZtqshdmulKJcIsWb45MUaEvDO4CROcgi8dfFg=
-github.com/bytebase/omni v0.0.0-20260403104830-b57a2edb14b0 h1:2WNHciMeHoo05/D9vsVqyg50W1eIKtzdg8+gOVYLj3Q=
-github.com/bytebase/omni v0.0.0-20260403104830-b57a2edb14b0/go.mod h1:SBAYEmMjJhA9WujfrIVIq76UFmsvNDOa5CekPhFXIis=
+github.com/bytebase/omni v0.0.0-20260407105220-3c81c575ccb5 h1:63Cm0LgttaYktTSfbw3AWSH0Gtt20pF307sE7Z3eUd8=
+github.com/bytebase/omni v0.0.0-20260407105220-3c81c575ccb5/go.mod h1:SBAYEmMjJhA9WujfrIVIq76UFmsvNDOa5CekPhFXIis=
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50 h1:Kq5wlhZ586Rch39y/IQV9MnrEzHob4iiXBG6zrbvSMU=
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50/go.mod h1:jeak/EfutSOAuWKvrFIT2IZunhWprM7oTFBRgZ9RCxo=
github.com/bytebase/pgx/v5 v5.0.0-20250212161523-96ff8aed8767 h1:YuR5G3LcxpO5ScSTA+Kdirxg9RW4TRc/v1t7N2Hfmbw=