postgresql/src/backend
Tom Lane 7c31874945 Avoid getting more than AccessShareLock when deparsing a query.
In make_ruledef and get_query_def, we have long used AcquireRewriteLocks
to ensure that the querytree we are about to deparse is up-to-date and
the schemas of the underlying relations aren't changing.  Howwever, that
function thinks the query is about to be executed, so it acquires locks
that are stronger than necessary for the purpose of deparsing.  Thus for
example, if pg_dump asks to deparse a rule that includes "INSERT INTO t",
we'd acquire RowExclusiveLock on t.  That results in interference with
concurrent transactions that might for example ask for ShareLock on t.
Since pg_dump is documented as being purely read-only, this is unexpected.
(Worse, it used to actually be read-only; this behavior dates back only
to 8.1, cf commit ba4200246.)

Fix this by adding a parameter to AcquireRewriteLocks to tell it whether
we want the "real" execution locks or only AccessShareLock.

Report, diagnosis, and patch by Dean Rasheed.  Back-patch to all supported
branches.
2014-03-06 19:31:05 -05:00
..
access Do wal_level and hot standby checks when doing crash-then-archive recovery. 2014-03-05 14:48:14 +02:00
bootstrap Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
catalog Constructors for interval, timestamp, timestamptz 2014-03-04 15:09:43 -03:00
commands Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
executor Don't reject ROW_MARK_REFERENCE rowmarks for materialized views. 2014-03-06 11:37:02 -05:00
foreign Update copyright for 2014 2014-01-07 16:05:30 -05:00
lib Update copyright for 2014 2014-01-07 16:05:30 -05:00
libpq Another round of Coverity fixes 2014-03-03 03:18:51 -05:00
main Fix possible crashes due to using elog/ereport too early in startup. 2014-01-11 16:36:07 -05:00
nodes Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
optimizer Fix bogus handling of "postponed" lateral quals. 2014-01-30 14:51:16 -05:00
parser Provide a FORCE NULL option to COPY in CSV mode. 2014-03-04 17:31:59 -05:00
po Translation updates 2013-12-02 00:17:07 -05:00
port Rename huge_tlb_pages to huge_pages, and improve docs. 2014-03-03 20:52:48 +02:00
postmaster Remove the correct pgstat file on DROP DATABASE 2014-03-05 13:03:29 -03:00
regex Allow regex operations to be terminated early by query cancel requests. 2014-03-01 15:20:56 -05:00
replication Send keepalives from walsender even when busy sending WAL. 2014-03-06 21:38:51 +02:00
rewrite Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
snowball Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion. 2014-02-23 16:59:05 -05:00
storage Fix some typos introduced by the logical decoding patch. 2014-03-05 13:00:22 -05:00
tcop Introduce logical decoding. 2014-03-03 16:32:18 -05:00
tsearch Another round of Coverity fixes 2014-03-03 03:18:51 -05:00
utils Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Get rid of use of dlltool in Mingw builds. 2014-02-11 12:56:20 -05:00
nls.mk Add libpgcommon to backend gettext source files 2013-10-19 13:49:05 -04:00