postgresql/src/backend/utils
Tomas Vondra 6cbfb784c3 Rework the pg_statistic_ext catalog
Since extended statistic got introduced in PostgreSQL 10, there was a
single catalog pg_statistic_ext storing both the definitions and built
statistic.  That's however problematic when a user is supposed to have
access only to the definitions, but not to user data.

Consider for example pg_dump on a database with RLS enabled - if the
pg_statistic_ext catalog respects RLS (which it should, if it contains
user data), pg_dump would not see any records and the result would not
define any extended statistics.  That would be a surprising behavior.

Until now this was not a pressing issue, because the existing types of
extended statistic (functional dependencies and ndistinct coefficients)
do not include any user data directly.  This changed with introduction
of MCV lists, which do include most common combinations of values.

The easiest way to fix this is to split the pg_statistic_ext catalog
into two - one for definitions, one for the built statistic values.
The new catalog is called pg_statistic_ext_data, and we're maintaining
a 1:1 relationship with the old catalog - either there are matching
records in both catalogs, or neither of them.

Bumped CATVERSION due to changing system catalog definitions.

Author: Dean Rasheed, with improvements by me
Reviewed-by: Dean Rasheed, John Naylor
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com
2019-06-16 01:20:31 +02:00
..
adt Fix incorrect printing of queries with duplicated join names. 2019-06-12 19:43:08 -04:00
cache Rework the pg_statistic_ext catalog 2019-06-16 01:20:31 +02:00
error Update copyright for 2019 2019-01-02 12:44:25 -05:00
fmgr Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
hash Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
init Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
mb Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
misc Fix typos. 2019-05-26 18:28:18 +05:30
mmgr Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
resowner Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
sort Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
time Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Partial implementation of SQL/JSON path language 2019-03-16 12:16:48 +03:00
Gen_dummy_probes.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00
Gen_dummy_probes.sed Update copyright for 2019 2019-01-02 12:44:25 -05:00
Gen_fmgrtab.pl Initial pgperltidy run for v12. 2019-05-22 13:36:19 -04:00
generate-errcodes.pl Update copyright for 2019 2019-01-02 12:44:25 -05:00
Makefile Use Getopt::Long for catalog scripts 2019-02-12 12:22:08 -03:00
probes.d Update copyright for 2019 2019-01-02 12:44:25 -05:00