aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_dump.c
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2016-05-06 14:06:50 -0400
committerStephen Frost <sfrost@snowman.net>2016-05-06 14:06:50 -0400
commite1b120a8cbb0f39a79926fd173f33e57202cdfa0 (patch)
tree6fd550b4bbea3471abe333c0e7b9ebf0578a783e /src/bin/pg_dump/pg_dump.c
parent5d589993cad212f7d556d52cc1e42fe18f65b057 (diff)
downloadpostgresql-e1b120a8cbb0f39a79926fd173f33e57202cdfa0.tar.gz
postgresql-e1b120a8cbb0f39a79926fd173f33e57202cdfa0.zip
Only issue LOCK TABLE commands when necessary
Reviewing the cases where we need to LOCK a given table during a dump, it was pointed out by Tom that we really don't need to LOCK a table if we are only looking to dump the ACL for it, or certain other components. After reviewing the queries run for all of the component pieces, a list of components were determined to not require LOCK'ing of the table. This implements a check to avoid LOCK'ing those tables. Initial complaint from Rushabh Lathia, discussed with Robert and Tom, the patch is mine.
Diffstat (limited to 'src/bin/pg_dump/pg_dump.c')
-rw-r--r--src/bin/pg_dump/pg_dump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index ee2e7d79d85..6e2610fa3ff 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -5953,8 +5953,11 @@ getTables(Archive *fout, int *numTables)
*
* NOTE: it'd be kinda nice to lock other relations too, not only
* plain tables, but the backend doesn't presently allow that.
+ *
+ * We only need to lock the table for certain components; see pg_dump.h
*/
- if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)
+ if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION &&
+ (tblinfo[i].dobj.dump & DUMP_COMPONENTS_REQUIRING_LOCK))
{
resetPQExpBuffer(query);
appendPQExpBuffer(query,