diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2021-09-01 17:41:54 +0200 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2021-09-01 17:41:56 +0200 |
commit | 537ca68dbb2463f7b1c44e9466b8fbdd7505b2e1 (patch) | |
tree | 1e31bf79164234a6da9a1abbc7f38c29e585b61a /contrib/postgres_fdw/postgres_fdw.c | |
parent | b0c066297bdac901a13a5a900a197697a026b357 (diff) | |
download | postgresql-537ca68dbb2463f7b1c44e9466b8fbdd7505b2e1.tar.gz postgresql-537ca68dbb2463f7b1c44e9466b8fbdd7505b2e1.zip |
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
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
0 files changed, 0 insertions, 0 deletions