@@ -165,9 +165,9 @@ static AclMode pg_type_aclmask_ext(Oid type_oid, Oid roleid,
165
165
AclMode mask , AclMaskHow how ,
166
166
bool * is_missing );
167
167
static void recordExtensionInitPriv (Oid objoid , Oid classoid , int objsubid ,
168
- Oid ownerId , Acl * new_acl );
168
+ Acl * new_acl );
169
169
static void recordExtensionInitPrivWorker (Oid objoid , Oid classoid , int objsubid ,
170
- Oid ownerId , Acl * new_acl );
170
+ Acl * new_acl );
171
171
172
172
173
173
/*
@@ -1802,7 +1802,7 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
1802
1802
CatalogTupleUpdate (attRelation , & newtuple -> t_self , newtuple );
1803
1803
1804
1804
/* Update initial privileges for extensions */
1805
- recordExtensionInitPriv (relOid , RelationRelationId , attnum , ownerId ,
1805
+ recordExtensionInitPriv (relOid , RelationRelationId , attnum ,
1806
1806
ACL_NUM (new_acl ) > 0 ? new_acl : NULL );
1807
1807
1808
1808
/* Update the shared dependency ACL info */
@@ -2062,8 +2062,7 @@ ExecGrant_Relation(InternalGrant *istmt)
2062
2062
CatalogTupleUpdate (relation , & newtuple -> t_self , newtuple );
2063
2063
2064
2064
/* Update initial privileges for extensions */
2065
- recordExtensionInitPriv (relOid , RelationRelationId , 0 ,
2066
- ownerId , new_acl );
2065
+ recordExtensionInitPriv (relOid , RelationRelationId , 0 , new_acl );
2067
2066
2068
2067
/* Update the shared dependency ACL info */
2069
2068
updateAclDependencies (RelationRelationId , relOid , 0 ,
@@ -2264,7 +2263,7 @@ ExecGrant_common(InternalGrant *istmt, Oid classid, AclMode default_privs,
2264
2263
CatalogTupleUpdate (relation , & newtuple -> t_self , newtuple );
2265
2264
2266
2265
/* Update initial privileges for extensions */
2267
- recordExtensionInitPriv (objectid , classid , 0 , ownerId , new_acl );
2266
+ recordExtensionInitPriv (objectid , classid , 0 , new_acl );
2268
2267
2269
2268
/* Update the shared dependency ACL info */
2270
2269
updateAclDependencies (classid ,
@@ -2416,8 +2415,7 @@ ExecGrant_Largeobject(InternalGrant *istmt)
2416
2415
CatalogTupleUpdate (relation , & newtuple -> t_self , newtuple );
2417
2416
2418
2417
/* Update initial privileges for extensions */
2419
- recordExtensionInitPriv (loid , LargeObjectRelationId , 0 ,
2420
- ownerId , new_acl );
2418
+ recordExtensionInitPriv (loid , LargeObjectRelationId , 0 , new_acl );
2421
2419
2422
2420
/* Update the shared dependency ACL info */
2423
2421
updateAclDependencies (LargeObjectRelationId ,
@@ -2589,7 +2587,7 @@ ExecGrant_Parameter(InternalGrant *istmt)
2589
2587
2590
2588
/* Update initial privileges for extensions */
2591
2589
recordExtensionInitPriv (parameterId , ParameterAclRelationId , 0 ,
2592
- ownerId , new_acl );
2590
+ new_acl );
2593
2591
2594
2592
/* Update the shared dependency ACL info */
2595
2593
updateAclDependencies (ParameterAclRelationId , parameterId , 0 ,
@@ -4477,7 +4475,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4477
4475
}
4478
4476
4479
4477
recordExtensionInitPrivWorker (objoid , classoid , curr_att ,
4480
- pg_class_tuple -> relowner ,
4481
4478
DatumGetAclP (attaclDatum ));
4482
4479
4483
4480
ReleaseSysCache (attTuple );
@@ -4490,7 +4487,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4490
4487
/* Add the record, if any, for the top-level object */
4491
4488
if (!isNull )
4492
4489
recordExtensionInitPrivWorker (objoid , classoid , 0 ,
4493
- pg_class_tuple -> relowner ,
4494
4490
DatumGetAclP (aclDatum ));
4495
4491
4496
4492
ReleaseSysCache (tuple );
@@ -4501,7 +4497,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4501
4497
Datum aclDatum ;
4502
4498
bool isNull ;
4503
4499
HeapTuple tuple ;
4504
- Form_pg_largeobject_metadata form_lo_meta ;
4505
4500
ScanKeyData entry [1 ];
4506
4501
SysScanDesc scan ;
4507
4502
Relation relation ;
@@ -4526,7 +4521,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4526
4521
tuple = systable_getnext (scan );
4527
4522
if (!HeapTupleIsValid (tuple ))
4528
4523
elog (ERROR , "could not find tuple for large object %u" , objoid );
4529
- form_lo_meta = (Form_pg_largeobject_metadata ) GETSTRUCT (tuple );
4530
4524
4531
4525
aclDatum = heap_getattr (tuple ,
4532
4526
Anum_pg_largeobject_metadata_lomacl ,
@@ -4535,7 +4529,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4535
4529
/* Add the record, if any, for the top-level object */
4536
4530
if (!isNull )
4537
4531
recordExtensionInitPrivWorker (objoid , classoid , 0 ,
4538
- form_lo_meta -> lomowner ,
4539
4532
DatumGetAclP (aclDatum ));
4540
4533
4541
4534
systable_endscan (scan );
@@ -4544,7 +4537,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4544
4537
else if (get_object_attnum_acl (classoid ) != InvalidAttrNumber )
4545
4538
{
4546
4539
int cacheid ;
4547
- Oid ownerId ;
4548
4540
Datum aclDatum ;
4549
4541
bool isNull ;
4550
4542
HeapTuple tuple ;
@@ -4555,17 +4547,14 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4555
4547
elog (ERROR , "cache lookup failed for %s %u" ,
4556
4548
get_object_class_descr (classoid ), objoid );
4557
4549
4558
- ownerId = DatumGetObjectId (SysCacheGetAttrNotNull (cacheid ,
4559
- tuple ,
4560
- get_object_attnum_owner (classoid )));
4561
4550
aclDatum = SysCacheGetAttr (cacheid , tuple ,
4562
4551
get_object_attnum_acl (classoid ),
4563
4552
& isNull );
4564
4553
4565
4554
/* Add the record, if any, for the top-level object */
4566
4555
if (!isNull )
4567
4556
recordExtensionInitPrivWorker (objoid , classoid , 0 ,
4568
- ownerId , DatumGetAclP (aclDatum ));
4557
+ DatumGetAclP (aclDatum ));
4569
4558
4570
4559
ReleaseSysCache (tuple );
4571
4560
}
@@ -4578,8 +4567,6 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
4578
4567
void
4579
4568
removeExtObjInitPriv (Oid objoid , Oid classoid )
4580
4569
{
4581
- Oid ownerId ;
4582
-
4583
4570
/*
4584
4571
* If this is a relation then we need to see if there are any sub-objects
4585
4572
* (eg: columns) for it and, if so, be sure to call
@@ -4594,7 +4581,6 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
4594
4581
if (!HeapTupleIsValid (tuple ))
4595
4582
elog (ERROR , "cache lookup failed for relation %u" , objoid );
4596
4583
pg_class_tuple = (Form_pg_class ) GETSTRUCT (tuple );
4597
- ownerId = pg_class_tuple -> relowner ;
4598
4584
4599
4585
/*
4600
4586
* Indexes don't have permissions, neither do the pg_class rows for
@@ -4631,44 +4617,17 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
4631
4617
4632
4618
/* when removing, remove all entries, even dropped columns */
4633
4619
4634
- recordExtensionInitPrivWorker (objoid , classoid , curr_att ,
4635
- ownerId , NULL );
4620
+ recordExtensionInitPrivWorker (objoid , classoid , curr_att , NULL );
4636
4621
4637
4622
ReleaseSysCache (attTuple );
4638
4623
}
4639
4624
}
4640
4625
4641
4626
ReleaseSysCache (tuple );
4642
4627
}
4643
- else
4644
- {
4645
- /* Must find out the owner's OID the hard way */
4646
- AttrNumber ownerattnum ;
4647
- int cacheid ;
4648
- HeapTuple tuple ;
4649
-
4650
- /*
4651
- * If the object is of a kind that has no owner, it should not have
4652
- * any pg_init_privs entry either.
4653
- */
4654
- ownerattnum = get_object_attnum_owner (classoid );
4655
- if (ownerattnum == InvalidAttrNumber )
4656
- return ;
4657
- cacheid = get_object_catcache_oid (classoid );
4658
- tuple = SearchSysCache1 (cacheid , ObjectIdGetDatum (objoid ));
4659
- if (!HeapTupleIsValid (tuple ))
4660
- elog (ERROR , "cache lookup failed for %s %u" ,
4661
- get_object_class_descr (classoid ), objoid );
4662
-
4663
- ownerId = DatumGetObjectId (SysCacheGetAttrNotNull (cacheid ,
4664
- tuple ,
4665
- ownerattnum ));
4666
-
4667
- ReleaseSysCache (tuple );
4668
- }
4669
4628
4670
4629
/* Remove the record, if any, for the top-level object */
4671
- recordExtensionInitPrivWorker (objoid , classoid , 0 , ownerId , NULL );
4630
+ recordExtensionInitPrivWorker (objoid , classoid , 0 , NULL );
4672
4631
}
4673
4632
4674
4633
/*
@@ -4680,8 +4639,7 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
4680
4639
* Pass in the object OID, the OID of the class (the OID of the table which
4681
4640
* the object is defined in) and the 'sub' id of the object (objsubid), if
4682
4641
* any. If there is no 'sub' id (they are currently only used for columns of
4683
- * tables) then pass in '0'. Also pass the OID of the object's owner.
4684
- * Finally, pass in the complete ACL to store.
4642
+ * tables) then pass in '0'. Finally, pass in the complete ACL to store.
4685
4643
*
4686
4644
* If an ACL already exists for this object/sub-object then we will replace
4687
4645
* it with what is passed in.
@@ -4690,8 +4648,7 @@ removeExtObjInitPriv(Oid objoid, Oid classoid)
4690
4648
* removed, if one is found.
4691
4649
*/
4692
4650
static void
4693
- recordExtensionInitPriv (Oid objoid , Oid classoid , int objsubid ,
4694
- Oid ownerId , Acl * new_acl )
4651
+ recordExtensionInitPriv (Oid objoid , Oid classoid , int objsubid , Acl * new_acl )
4695
4652
{
4696
4653
/*
4697
4654
* Generally, we only record the initial privileges when an extension is
@@ -4704,7 +4661,7 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid,
4704
4661
if (!creating_extension && !binary_upgrade_record_init_privs )
4705
4662
return ;
4706
4663
4707
- recordExtensionInitPrivWorker (objoid , classoid , objsubid , ownerId , new_acl );
4664
+ recordExtensionInitPrivWorker (objoid , classoid , objsubid , new_acl );
4708
4665
}
4709
4666
4710
4667
/*
@@ -4721,7 +4678,7 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid,
4721
4678
*/
4722
4679
static void
4723
4680
recordExtensionInitPrivWorker (Oid objoid , Oid classoid , int objsubid ,
4724
- Oid ownerId , Acl * new_acl )
4681
+ Acl * new_acl )
4725
4682
{
4726
4683
Relation relation ;
4727
4684
ScanKeyData key [3 ];
0 commit comments