aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-01-19 17:56:40 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-01-19 17:56:40 -0500
commit26d905a12dda783783c60cec04decb00cd2e67f4 (patch)
tree81593b7d91036be3ca5bbc67116db9ac009970c3 /src
parent4b94cfb5647c97a80368346ee0a17f40d301cb63 (diff)
downloadpostgresql-26d905a12dda783783c60cec04decb00cd2e67f4.tar.gz
postgresql-26d905a12dda783783c60cec04decb00cd2e67f4.zip
Use SET TRANSACTION READ ONLY in pg_dump, if server supports it.
This currently does little except serve as documentation. (The one case where it has a performance benefit, SERIALIZABLE mode in 9.1 and up, was already using READ ONLY mode.) However, it's possible that it might have performance benefits in future, and in any case it seems like good practice since it would catch any accidentally non-read-only operations. Pavan Deolasee
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 9b71c75c334..6295b5bf2cc 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -618,7 +618,14 @@ main(int argc, char **argv)
else
ExecuteSqlStatement(fout,
"SET TRANSACTION ISOLATION LEVEL "
- "REPEATABLE READ");
+ "REPEATABLE READ, READ ONLY");
+ }
+ else if (fout->remoteVersion >= 70400)
+ {
+ /* note: comma was not accepted in SET TRANSACTION before 8.0 */
+ ExecuteSqlStatement(fout,
+ "SET TRANSACTION ISOLATION LEVEL "
+ "SERIALIZABLE READ ONLY");
}
else
ExecuteSqlStatement(fout,