Skip to content

Commit

Permalink
sql: fix panic due to missing schema
Browse files Browse the repository at this point in the history
A schema might not exist because it has been dropped. We need to mark the
lookup as required.

Fixes #87895

Release note (bug fix): Fixed a bug in pg_catalog tables which could result in
an internal error if a schema is concurrently dropped.
  • Loading branch information
ajwerner committed Sep 23, 2022
1 parent 099da40 commit 5ae96bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/sql/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,9 @@ func makeAllRelationsVirtualTableWithDescriptorIDIndex(
h := makeOidHasher()
scResolver := oneAtATimeSchemaResolver{p: p, ctx: ctx}
sc, err := p.Descriptors().GetImmutableSchemaByID(
ctx, p.txn, table.GetParentSchemaID(), tree.SchemaLookupFlags{})
ctx, p.txn, table.GetParentSchemaID(), tree.SchemaLookupFlags{
Required: true,
})
if err != nil {
return false, err
}
Expand Down

0 comments on commit 5ae96bd

Please sign in to comment.