Skip to content

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

fix: npe when schema is empty (#9455)

h3n4l2fcc8f3dbdad
diff --git a/backend/plugin/parser/pg/v2/query_span_extractor.go b/backend/plugin/parser/pg/v2/query_span_extractor.go
index d338fec2bc..014258abca 100644
--- a/backend/plugin/parser/pg/v2/query_span_extractor.go
+++ b/backend/plugin/parser/pg/v2/query_span_extractor.go
@@ -782,6 +782,9 @@ func (q *querySpanExtractor) findTableSchema(schemaName string, tableName string
schemaName = "public"
}
schema := dbSchema.GetSchema(schemaName)
+ if schema == nil {
+ return nil, errors.Errorf("schema %s not found", schemaName)
+ }
table := schema.GetTable(tableName)
if table == nil {
return nil, errors.Errorf("table %s.%s not found", schemaName, tableName)