postgresql/src/backend/utils
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
..
adt Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
cache Introduce logical decoding. 2014-03-03 16:32:18 -05:00
error Fix possible crashes due to using elog/ereport too early in startup. 2014-01-11 16:36:07 -05:00
fmgr Prevent privilege escalation in explicit calls to PL validators. 2014-02-17 09:33:31 -05:00
hash Update copyright for 2014 2014-01-07 16:05:30 -05:00
init Mark some more variables as static or include the appropriate header 2014-02-08 21:21:46 -05:00
mb Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion. 2014-02-23 16:59:05 -05:00
misc Rename huge_tlb_pages to huge_pages, and improve docs. 2014-03-03 20:52:48 +02:00
mmgr Allow use of "z" flag in our printf calls, and use it where appropriate. 2014-01-23 17:18:33 -05:00
resowner Update copyright for 2014 2014-01-07 16:05:30 -05:00
sort Update copyright for 2014 2014-01-07 16:05:30 -05:00
time Introduce logical decoding. 2014-03-03 16:32:18 -05:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Update copyright for 2014 2014-01-07 16:05:30 -05:00
Gen_dummy_probes.sed Update copyright for 2014 2014-01-07 16:05:30 -05:00
Gen_fmgrtab.pl Update copyright for 2014 2014-01-07 16:05:30 -05:00
generate-errcodes.pl Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Relax the requirement that all lwlocks be stored in a single array. 2014-01-27 11:07:44 -05:00