Skip to content

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

fix(pg): exclude aggregates from function sync to fix schema load [BYT-9076] (#19694)

rebelice225b39296e85
diff --git a/backend/plugin/db/pg/sync.go b/backend/plugin/db/pg/sync.go
index 347926205a..9204333985 100644
--- a/backend/plugin/db/pg/sync.go
+++ b/backend/plugin/db/pg/sync.go
@@ -1710,6 +1710,7 @@ from pg_proc p
where n.nspname not in (%s)
AND n.nspname NOT LIKE 'pg_temp%%'
AND n.nspname NOT LIKE 'pg_toast%%'
+ AND p.prokind <> 'a'
AND pt.typrelid IS NOT NULL
`, pgparser.SystemSchemaWhereClause)
@@ -1752,6 +1753,7 @@ left join pg_type t on t.oid = p.prorettype ` + fmt.Sprintf(`
where n.nspname not in (%s)
AND n.nspname NOT LIKE 'pg_temp%%'
AND n.nspname NOT LIKE 'pg_toast%%'
+ AND p.prokind <> 'a'
order by function_schema, function_name;`, pgparser.SystemSchemaWhereClause)
// getFunctions gets all functions of a database.