@@ -1250,7 +1250,7 @@ func makeAllRelationsVirtualTableWithDescriptorIDIndex(
12501250 ctx ,
12511251 p ,
12521252 dbContext ,
1253- false ,
1253+ false , /* includeMetadata */
12541254 func (ctx context.Context , _ catalog.DatabaseDescriptor , sc catalog.SchemaDescriptor , typeDesc catalog.TypeDescriptor ) error {
12551255 nspOid := schemaOid (sc .GetID ())
12561256 tn := tree .NewQualifiedTypeName (dbContext .GetName (), sc .GetName (), typeDesc .GetName ())
@@ -1803,7 +1803,7 @@ https://www.postgresql.org/docs/9.5/catalog-pg-depend.html`,
18031803 if err != nil {
18041804 return err
18051805 }
1806- return forEachSchema (ctx , p , dbContext , true , false /* includeMetadata */ , func (ctx context.Context , sc catalog.SchemaDescriptor ) error {
1806+ return forEachSchema (ctx , p , dbContext , true /* requiresPrivileges */ , false /* includeMetadata */ , func (ctx context.Context , sc catalog.SchemaDescriptor ) error {
18071807 pgProcTableOid := tableOid (pgProcDesc .GetID ())
18081808 return sc .ForEachFunctionSignature (func (sig descpb.SchemaDescriptor_FunctionSignature ) error {
18091809 funcDesc , err := descs .GetCatalogDescriptorGetter (p .Descriptors (), p .txn , & p .EvalContext ().Settings .SV ).Get ().Function (ctx , sig .ID )
@@ -2303,7 +2303,7 @@ https://www.postgresql.org/docs/9.5/catalog-pg-namespace.html`,
23032303 populate : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , addRow func (... tree.Datum ) error ) error {
23042304 return forEachDatabaseDesc (ctx , p , dbContext , true , /* requiresPrivileges */
23052305 func (ctx context.Context , db catalog.DatabaseDescriptor ) error {
2306- return forEachSchema (ctx , p , db , true , false /* includeMetadata */ , func (ctx context.Context , sc catalog.SchemaDescriptor ) error {
2306+ return forEachSchema (ctx , p , db , true /* requiresPrivileges */ , false /* includeMetadata */ , func (ctx context.Context , sc catalog.SchemaDescriptor ) error {
23072307 ownerOID := tree .DNull
23082308 if sc .SchemaKind () == catalog .SchemaUserDefined {
23092309 var err error
@@ -2348,7 +2348,7 @@ https://www.postgresql.org/docs/9.5/catalog-pg-namespace.html`,
23482348 }
23492349 // Fallback to looking for temporary schemas.
23502350 var tempSchema catalog.SchemaDescriptor
2351- if err := forEachSchema (ctx , p , db , false , false /* includeMetadata */ , func (ctx context.Context , schema catalog.SchemaDescriptor ) error {
2351+ if err := forEachSchema (ctx , p , db , false /* requiresPrivileges */ , false /* includeMetadata */ , func (ctx context.Context , schema catalog.SchemaDescriptor ) error {
23522352 if schema .GetID () != descpb .ID (ooid ) {
23532353 return nil
23542354 }
@@ -2891,7 +2891,7 @@ https://www.postgresql.org/docs/16/catalog-pg-proc.html`,
28912891 }
28922892 return forEachDatabaseDesc (ctx , p , dbContext , false , /* requiresPrivileges */
28932893 func (ctx context.Context , dbDesc catalog.DatabaseDescriptor ) error {
2894- return forEachSchema (ctx , p , dbDesc , true , false /* includeMetadata */ , func (ctx context.Context , scDesc catalog.SchemaDescriptor ) error {
2894+ return forEachSchema (ctx , p , dbDesc , true /* requiresPrivileges */ , false /* includeMetadata */ , func (ctx context.Context , scDesc catalog.SchemaDescriptor ) error {
28952895 return scDesc .ForEachFunctionSignature (func (sig descpb.SchemaDescriptor_FunctionSignature ) error {
28962896 fnDesc , err := descs .GetCatalogDescriptorGetter (p .Descriptors (), p .Txn (), & p .EvalContext ().Settings .SV ).WithoutNonPublic ().Get ().Function (ctx , sig .ID )
28972897 if err != nil {
@@ -5676,7 +5676,7 @@ func populateVirtualIndexForTable(
56765676 // Ideally, the catalog API would be able to return the temporary
56775677 // schemas from other sessions, but it cannot right now. See
56785678 // https://github.com/cockroachdb/cockroach/issues/97822.
5679- if err := forEachSchema (ctx , p , dbContext , false , false , func (ctx context.Context , schema catalog.SchemaDescriptor ) error {
5679+ if err := forEachSchema (ctx , p , dbContext , false /* requiresPrivileges */ , false /* includeMetadata */ , func (ctx context.Context , schema catalog.SchemaDescriptor ) error {
56805680 if schema .GetID () == tableDesc .GetParentSchemaID () {
56815681 sc = schema
56825682 }
0 commit comments