diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
new file mode 100644
index d9aeee3..4f5eec3
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** getTables(Archive *fout, int *numTables)
*** 3833,3838 ****
--- 3833,3839 ----
  	int			i_reloptions;
  	int			i_toastreloptions;
  	int			i_reloftype;
+ 	bool		lock_needed = false;
  
  	/* Make sure we are in proper schema */
  	selectSourceSchema(fout, "pg_catalog");
*************** getTables(Archive *fout, int *numTables)
*** 4274,4288 ****
  		 * NOTE: it'd be kinda nice to lock other relations too, not only
  		 * plain tables, but the backend doesn't presently allow that.
  		 */
! 		if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)
  		{
  			resetPQExpBuffer(query);
! 			appendPQExpBuffer(query,
! 							  "LOCK TABLE %s IN ACCESS SHARE MODE",
! 							  fmtQualifiedId(fout,
  										tblinfo[i].dobj.namespace->dobj.name,
! 											 tblinfo[i].dobj.name));
! 			ExecuteSqlStatement(fout, query->data);
  		}
  
  		/* Emit notice if join for owner failed */
--- 4275,4295 ----
  		 * NOTE: it'd be kinda nice to lock other relations too, not only
  		 * plain tables, but the backend doesn't presently allow that.
  		 */
! 		if (i == 0)
  		{
  			resetPQExpBuffer(query);
! 			appendPQExpBuffer(query,"LOCK TABLE ");
! 		}
! 
! 		if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)
! 		{
! 			if (lock_needed)
! 				appendPQExpBuffer(query,",");
! 			appendPQExpBuffer(query,"%s",
! 						 fmtQualifiedId(fout,
  										tblinfo[i].dobj.namespace->dobj.name,
! 										tblinfo[i].dobj.name));
! 			lock_needed = true;
  		}
  
  		/* Emit notice if join for owner failed */
*************** getTables(Archive *fout, int *numTables)
*** 4291,4296 ****
--- 4298,4309 ----
  					  tblinfo[i].dobj.name);
  	}
  
+ 	if (lock_needed)
+ 	{
+ 		appendPQExpBuffer(query, " IN ACCESS SHARE MODE");
+ 		ExecuteSqlStatement(fout, query->data);
+ 	}
+ 
  	if (lockWaitTimeout && fout->remoteVersion >= 70300)
  	{
  		ExecuteSqlStatement(fout, "SET statement_timeout = 0");
