@@ -598,7 +598,6 @@ ExecCheckPermissions(List *rangeTable, List *rteperminfos,
598598 foreach (l , rangeTable )
599599 {
600600 RangeTblEntry * rte = lfirst_node (RangeTblEntry , l );
601- bool is_enr = (sql_dialect == SQL_DIALECT_TSQL && GetENRTempTableWithOid (rte -> relid ));
602601
603602 if (rte -> perminfoindex != 0 )
604603 {
@@ -612,22 +611,6 @@ ExecCheckPermissions(List *rangeTable, List *rteperminfos,
612611 (rte -> rtekind == RTE_SUBQUERY &&
613612 rte -> relkind == RELKIND_VIEW ));
614613
615- /*
616- * Ensure that we have at least an AccessShareLock on relations
617- * whose permissions need to be checked.
618- *
619- * Skip this check in a parallel worker because locks won't be
620- * taken until ExecInitNode() performs plan initialization.
621- *
622- * Skip this check if this relation is in ENR since we don't hold
623- * locks for relations in ENRs
624- *
625- * XXX: ExecCheckPermissions() in a parallel worker may be
626- * redundant with the checks done in the leader process, so this
627- * should be reviewed to ensure it’s necessary.
628- */
629- Assert (IsParallelWorker () || is_enr || CheckRelationOidLockedByMe (rte -> relid , AccessShareLock , true));
630-
631614 (void ) getRTEPermissionInfo (rteperminfos , rte );
632615 /* Many-to-one mapping not allowed */
633616 Assert (!bms_is_member (rte -> perminfoindex , indexset ));
0 commit comments