postgresql/src/test/regress
Dean Rasheed a0905056fd Use checkAsUser for selectivity estimator checks, if it's set.
In examine_variable() and examine_simple_variable(), when checking the
user's table and column privileges to determine whether to grant
access to the pg_statistic data, use checkAsUser for the privilege
checks, if it's set. This will be the case if we're accessing the
table via a view, to indicate that we should perform privilege checks
as the view owner rather than the current user.

This change makes this planner check consistent with the check in the
executor, so the planner will be able to make use of statistics if the
table is accessible via the view. This fixes a performance regression
introduced by commit e2d4ef8de8, which affects queries against
non-security barrier views in the case where the user doesn't have
privileges on the underlying table, but the view owner does.

Note that it continues to provide the same safeguards controlling
access to pg_statistic for direct table access (in which case
checkAsUser won't be set) and for security barrier views, because of
the nearby checks on rte->security_barrier and rte->securityQuals.

Back-patch to all supported branches because e2d4ef8de8 was.

Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.
2019-05-06 11:54:32 +01:00
..
data Improve key representation for GIN jsonb_ops, and fix existence-search bug. 2014-05-09 08:41:26 -04:00
expected Use checkAsUser for selectivity estimator checks, if it's set. 2019-05-06 11:54:32 +01:00
input Fix tablespace inheritance for partitioned rels 2019-04-25 10:31:32 -04:00
output Message style fixes 2019-04-30 10:33:37 -04:00
sql Use checkAsUser for selectivity estimator checks, if it's set. 2019-05-06 11:54:32 +01:00
.gitignore Update .gitignore for config.cache. 2014-12-18 19:56:42 +09:00
GNUmakefile Unified logging system for command-line programs 2019-04-01 20:01:35 +02:00
Makefile Fix non-GNU makefiles for AIX make. 2017-11-30 00:57:22 -08:00
parallel_schedule Run catalog reindexing test from 3dbb317d32 serially, to avoid deadlocks. 2019-04-30 17:45:32 -07:00
pg_regress_main.c tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
pg_regress.c Clean up minor warnings from buildfarm. 2019-04-28 12:45:55 -04:00
pg_regress.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
README Don't generate plain-text HISTORY and src/test/regress/README anymore. 2014-02-10 20:48:04 -05:00
regress.c Build out the planner support function infrastructure. 2019-02-09 18:32:23 -05:00
regressplans.sh Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
resultmap Cygwin and Mingw floating-point fixes. 2019-02-16 01:50:16 +00:00
serial_schedule Run catalog reindexing test from 3dbb317d32 serially, to avoid deadlocks. 2019-04-30 17:45:32 -07:00
standby_schedule Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00

Documentation concerning how to run these regression tests and interpret
the results can be found in the PostgreSQL manual, in the chapter
"Regression Tests".