Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdffad02

Browse files
author
Neil Conway
committed
Slight refactor for ExecOpenScanRelation(): we can use
ExecRelationIsTargetRelation() to check if the relation is a targetrel, rather than scanning through the result relation array ourselves.
1 parentdc6dc0f commitdffad02

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

‎src/backend/executor/execUtils.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.147 2007/02/2701:11:25 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.148 2007/07/2719:09:04 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -814,24 +814,16 @@ ExecOpenScanRelation(EState *estate, Index scanrelid)
814814
{
815815
Oidreloid;
816816
LOCKMODElockmode;
817-
ResultRelInfo*resultRelInfos;
818-
inti;
819817

820818
/*
821-
*First determinethe lock type we need.Scanto see if target relation
822-
*is either a resultrelationor aFOR UPDATE/FOR SHARE relation.
819+
*Determinethe lock type we need.First, scanto see if target
820+
* relationis aresult relation.
823821
*/
824822
lockmode=AccessShareLock;
825-
resultRelInfos=estate->es_result_relations;
826-
for (i=0;i<estate->es_num_result_relations;i++)
827-
{
828-
if (resultRelInfos[i].ri_RangeTableIndex==scanrelid)
829-
{
830-
lockmode=NoLock;
831-
break;
832-
}
833-
}
823+
if (ExecRelationIsTargetRelation(estate,scanrelid))
824+
lockmode=NoLock;
834825

826+
/* If not, check if it's a FOR UPDATE/FOR SHARE relation */
835827
if (lockmode==AccessShareLock)
836828
{
837829
ListCell*l;
@@ -850,7 +842,6 @@ ExecOpenScanRelation(EState *estate, Index scanrelid)
850842

851843
/* OK, open the relation and acquire lock as needed */
852844
reloid=getrelid(scanrelid,estate->es_range_table);
853-
854845
returnheap_open(reloid,lockmode);
855846
}
856847

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp