From 0ea0afa44452b617ce1259cff27b2a24247e8b8e Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 3 Mar 2010 23:38:44 +0000
Subject: [PATCH] Add C comment about DDL changes possibly causing pg_dump
 errors.

---
 src/bin/pg_dump/pg_dump.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 44bdddaf88d..18dd71e364f 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -11,8 +11,21 @@
  *	script that reproduces the schema in terms of SQL that is understood
  *	by PostgreSQL
  *
+ *	Note that pg_dump runs in a serializable transaction, so it sees a
+ *	consistent snapshot of the database including system catalogs.
+ *	However, it relies in part on various specialized backend functions
+ *	like pg_get_indexdef(), and those things tend to run on SnapshotNow
+ *	time, ie they look at the currently committed state.  So it is
+ *	possible to get 'cache lookup failed' error if someone performs DDL
+ *	changes while a dump is happening. The window for this sort of thing
+ *	is from the beginning of the serializable transaction to
+ *	getSchemaData() (when pg_dump acquires AccessShareLock on every
+ *	table it intends to dump). It isn't very large, but it can happen.
+ *
+ *	http://archives.postgresql.org/pgsql-bugs/2010-02/msg00187.php
+ *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.576 2010/03/03 20:10:48 heikki Exp $
+ *	  $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.577 2010/03/03 23:38:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
-- 
GitLab