← Back to Overview

src/backend/utils/cache/plancache.c

Coverage: 0/0 lines (0.0%)
Total Lines
0
modified
Covered
0
0.0%
Uncovered
0
100.0%
키보드 네비게이션
ScanQueryForLocks() lines 1990-2054
Modified Lines Coverage: 0/0 lines (0.0%)
LineHitsSourceCommit
1990 - ScanQueryForLocks(Query *parsetree, bool acquire) -
1991 - { -
1992 - ListCell *lc; -
1993 - -
1994 - /* Shouldn't get called on utility commands */ -
1995 - Assert(parsetree->commandType != CMD_UTILITY); -
1996 - -
1997 - /* -
1998 - * First, process RTEs of the current query level. -
1999 - */ -
2000 - foreach(lc, parsetree->rtable) -
2001 - { -
2002 - RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc); -
2003 - -
2004 - switch (rte->rtekind) -
2005 - { -
2006 - case RTE_RELATION: -
2007 - /* Acquire or release the appropriate type of lock */ -
2008 - if (acquire) -
2009 - LockRelationOid(rte->relid, rte->rellockmode); -
2010 - else -
2011 - UnlockRelationOid(rte->relid, rte->rellockmode); -
2012 - break; -
2013 - -
2014 - case RTE_SUBQUERY: -
2015 - 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
2016 - /* 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
2017 - * If this was a view or a property graph, must lock/unlock 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
2018 - * it. 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
2019 - */ 86c14eaWIP: SQL Property Graph Queries (SQL/PGQ)
2020 - if (OidIsValid(rte->relid)) -
2021 - { -
2022 - if (acquire) -
2023 - LockRelationOid(rte->relid, rte->rellockmode); -
2024 - else -
2025 - UnlockRelationOid(rte->relid, rte->rellockmode); -
2026 - } -
2027 - /* Recurse into subquery-in-FROM */ -
2028 - ScanQueryForLocks(rte->subquery, acquire); -
2029 - break; -
2030 - -
2031 - default: -
2032 - /* ignore other types of RTEs */ -
2033 - break; -
2034 - } -
2035 - } -
2036 - -
2037 - /* Recurse into subquery-in-WITH */ -
2038 - foreach(lc, parsetree->cteList) -
2039 - { -
2040 - CommonTableExpr *cte = lfirst_node(CommonTableExpr, lc); -
2041 - -
2042 - ScanQueryForLocks(castNode(Query, cte->ctequery), acquire); -
2043 - } -
2044 - -
2045 - /* -
2046 - * Recurse into sublink subqueries, too. But we already did the ones in -
2047 - * the rtable and cteList. -
2048 - */ -
2049 - if (parsetree->hasSubLinks) -
2050 - { -
2051 - query_tree_walker(parsetree, ScanQueryWalker, &acquire, -
2052 - QTW_IGNORE_RC_SUBQUERIES); -
2053 - } -
2054 - } -