postgresql/src
Tom Lane fd19525756 Put back one copyObject() in rewriteTargetView().
Commit 6f8cb1e234 tried to centralize rewriteTargetView's copying
of a target view's Query struct.  However, it ignored the fact that the
jointree->quals field was used twice.  This only accidentally failed to
fail immediately because the same ChangeVarNodes mutation is applied in
both cases, so that we end up with logically identical expression trees
for both uses (and, as the code stands, the second ChangeVarNodes call
actually does nothing).  However, we end up linking *physically*
identical expression trees into both an RTE's securityQuals list and
the WithCheckOption list.  That's pretty dangerous, mainly because
prepsecurity.c is utterly cavalier about further munging such structures
without copying them first.

There may be no live bug in HEAD as a consequence of the fact that we apply
preprocess_expression in between here and prepsecurity.c, and that will
make a copy of the tree anyway.  Or it may just be that the regression
tests happen to not trip over it.  (I noticed this only because things
fell over pretty badly when I tried to relocate the planner's call of
expand_security_quals to before expression preprocessing.)  In any case
it's very fragile because if anyone tried to make the securityQuals and
WithCheckOption trees diverge before we reach preprocess_expression, it
would not work.  The fact that the current code will preprocess
securityQuals and WithCheckOptions lists at completely different times in
different query levels does nothing to increase my trust that that can't
happen.

In view of the fact that 9.5.0 is almost upon us and the aforesaid commit
has seen exactly zero field testing, the prudent course is to make an extra
copy of the quals so that the behavior is not different from what has been
in the field during beta.
2015-12-29 16:45:47 -05:00
..
backend Put back one copyObject() in rewriteTargetView(). 2015-12-29 16:45:47 -05:00
bin Rename (new|old)estCommitTs to (new|old)estCommitTsXid 2015-12-28 12:34:11 -08:00
common pgindent run for 9.5 2015-05-23 21:35:49 -04:00
include Rename (new|old)estCommitTs to (new|old)estCommitTsXid 2015-12-28 12:34:11 -08:00
interfaces Remove unnecessary escaping in C character literals 2015-12-22 22:43:46 -05:00
makefiles Remove support for Unix systems without the POSIX signal APIs. 2015-08-31 12:56:10 -04:00
pl Instruct Coverity using an assertion. 2015-12-05 03:04:17 -05:00
port Adopt the GNU convention for handling tar-archive members exceeding 8GB. 2015-11-21 20:21:31 -05:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
timezone Update time zone data files to tzdata release 2015g. 2015-10-02 19:15:39 -04:00
tools Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
tutorial Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
.gitignore
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Make prove_installcheck remove the old log directory, if any. 2015-10-11 20:36:07 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00