pgsql: Disallow extended statistics on system columns

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow extended statistics on system columns
Date: 2021-09-19 23:01:02
Message-ID: E1mS5ny-00074E-V0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Disallow extended statistics on system columns

Since introduction of extended statistics, we've disallowed references
to system columns. So for example

CREATE STATISTICS s ON ctid FROM t;

would fail. But with extended statistics on expressions, it was possible
to work around this limitation quite easily

CREATE STATISTICS s ON (ctid::text) FROM t;

This is an oversight in a4d75c86bf, fixed by adding a simple check.
Backpatch to PostgreSQL 14, where support for extended statistics on
expressions was introduced.

Backpatch-through: 14
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c9eeef2a15c02ff7dd2bf3251dbee925b050fc0f

Modified Files
--------------
src/backend/commands/statscmds.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2021-09-19 23:01:15 pgsql: Disallow extended statistics on system columns
Previous Message Tom Lane 2021-09-19 16:51:06 Re: pgsql: Add list of acknowledgments to release notes