postgresql/src/backend/commands
Tomas Vondra 537ca68dbb Identify simple column references in extended statistics
Until now, when defining extended statistics, everything except a plain
column reference was treated as complex expression. So for example "a"
was a column reference, but "(a)" would be an expression. In most cases
this does not matter much, but there were a couple strange consequences.
For example

    CREATE STATISTICS s ON a FROM t;

would fail, because extended stats require at least two columns. But

    CREATE STATISTICS s ON (a) FROM t;

would succeed, because that requirement does not apply to expressions.
Moreover, that statistics object is useless - the optimizer will always
use the regular statistics collected for attribute "a".

So do a bit more work to identify those expressions referencing a single
column, and translate them to a simple column reference. Backpatch to
14, where support for extended statistics on expressions was introduced.

Reported-by: Justin Pryzby
Backpatch-through: 14
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com
2021-09-01 17:41:56 +02:00
..
Makefile Split copy.c into four files. 2020-11-23 10:50:50 +02:00
aggregatecmds.c SQL-standard function body 2021-04-07 21:47:55 +02:00
alter.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
amcmds.c Fix some typos, grammar and style in docs and comments 2021-02-24 16:13:17 +09:00
analyze.c Keep stats up to date for partitioned tables 2021-08-28 15:58:23 -04:00
async.c Remove server and libpq support for old FE/BE protocol version 2. 2021-03-04 10:45:55 +02:00
cluster.c Fix toast rewrites in logical decoding. 2021-08-25 09:53:07 +05:30
collationcmds.c Improve error checking of CREATE COLLATION options. 2021-07-18 11:08:34 +01:00
comment.c Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
constraint.c Pass down "logically unchanged index" hint. 2021-01-13 08:11:00 -08:00
conversioncmds.c Add 'noError' argument to encoding conversion functions. 2021-04-01 11:45:22 +03:00
copy.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
copyfrom.c Fix typos and grammar in documentation and code comments 2021-04-09 13:53:07 +09:00
copyfromparse.c Add heuristic incoming-message-size limits in the server. 2021-04-28 15:50:46 -04:00
copyto.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
createas.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
dbcommands.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
define.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
discard.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
dropcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
event_trigger.c In event triggers, use "pg_temp" only for our own temp schema. 2021-07-27 12:08:20 -04:00
explain.c Use ExplainPropertyInteger for queryid in EXPLAIN 2021-08-09 15:47:23 +12:00
extension.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
foreigncmds.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
functioncmds.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
indexcmds.c Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
lockcmds.c Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
matview.c Really fix the ambiguity in REFRESH MATERIALIZED VIEW CONCURRENTLY. 2021-08-07 13:29:32 -04:00
opclasscmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
operatorcmds.c Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership. 2021-08-17 14:29:22 -04:00
policy.c Remove unnecessary failure cases in RemoveRoleFromObjectPolicy(). 2021-06-25 13:59:38 -04:00
portalcmds.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
prepare.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
proclang.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
publicationcmds.c Use l*_node() family of functions where appropriate 2021-07-19 08:20:24 +02:00
schemacmds.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
seclabel.c Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
sequence.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
statscmds.c Identify simple column references in extended statistics 2021-09-01 17:41:56 +02:00
subscriptioncmds.c Fix Alter Subscription's Add/Drop Publication behavior. 2021-08-24 08:25:21 +05:30
tablecmds.c Fix toast rewrites in logical decoding. 2021-08-25 09:53:07 +05:30
tablespace.c Fix data loss in wal_level=minimal crash recovery of CREATE TABLESPACE. 2021-08-27 23:33:23 -07:00
trigger.c Remove newly added useless assertion check 2021-07-26 12:56:33 -04:00
tsearchcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
typecmds.c Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership. 2021-08-17 14:29:22 -04:00
user.c Improve reporting of "conflicting or redundant options" errors. 2021-07-15 08:49:45 +01:00
vacuum.c Support disabling index bypassing by VACUUM. 2021-06-18 20:04:07 -07:00
variable.c Fix some inappropriately-disallowed uses of ALTER ROLE/DATABASE SET. 2021-04-13 15:10:18 -04:00
view.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00