summaryrefslogtreecommitdiff
path: root/src/backend/commands/analyze.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-09-30 23:21:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-09-30 23:21:26 +0000
commitd2af5f8a3e89f02dd54949fa42e2dcd31ddcd5c7 (patch)
tree122463e70e53c0fd7ae418dc8eb9057ffedae130 /src/backend/commands/analyze.c
parentd6748843069f7dd4205cd85b60977b5414647635 (diff)
Adjust index locking rules as per my proposal of earlier today. You
now are supposed to take some kind of lock on an index whenever you are going to access the index contents, rather than relying only on a lock on the parent table.
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r--src/backend/commands/analyze.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index ce7db272113..486e86d677c 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.76 2004/08/29 05:06:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.77 2004/09/30 23:21:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -243,7 +243,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
* if there was an explicit column list in the ANALYZE command,
* however.
*/
- vac_open_indexes(onerel, &nindexes, &Irel);
+ vac_open_indexes(onerel, AccessShareLock, &nindexes, &Irel);
hasindex = (nindexes > 0);
indexdata = NULL;
analyzableindex = false;
@@ -310,7 +310,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
*/
if (attr_cnt <= 0 && !analyzableindex)
{
- vac_close_indexes(nindexes, Irel);
+ vac_close_indexes(nindexes, Irel, AccessShareLock);
relation_close(onerel, AccessShareLock);
return;
}
@@ -427,7 +427,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
}
/* Done with indexes */
- vac_close_indexes(nindexes, Irel);
+ vac_close_indexes(nindexes, Irel, NoLock);
/*
* Close source relation now, but keep lock so that no one deletes it