postgresql/src/backend/commands
Tom Lane 6286526207 Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD.
The standard typanalyze functions skip over values whose detoasted size
exceeds WIDTH_THRESHOLD (1024 bytes), so as to limit memory bloat during
ANALYZE.  However, we (I think I, actually :-() failed to consider the
possibility that *every* non-null value in a column is too wide.  While
compute_minimal_stats() seems to behave reasonably anyway in such a case,
compute_scalar_stats() just fell through and generated no pg_statistic
entry at all.  That's unnecessarily pessimistic: we can still produce
valid stanullfrac and stawidth values in such cases, since we do include
too-wide values in the average-width calculation.  Furthermore, since the
general assumption in this code is that too-wide values are probably all
distinct from each other, it seems reasonable to set stadistinct to -1
("all distinct").

Per complaint from Kadri Raudsepp.  This has been like this since roughly
neolithic times, so back-patch to all supported branches.
2014-01-11 13:42:42 -05:00
..
Makefile Add a materialized view relations. 2013-03-03 18:23:31 -06:00
aggregatecmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
alter.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
analyze.c Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD. 2014-01-11 13:42:42 -05:00
async.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
cluster.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
collationcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
comment.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
constraint.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
conversioncmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
copy.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
createas.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dbcommands.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
define.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
discard.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dropcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
event_trigger.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
explain.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
extension.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
foreigncmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
functioncmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
indexcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
lockcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
matview.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
opclasscmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
operatorcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
portalcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
prepare.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
proclang.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
schemacmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
seclabel.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
sequence.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tablecmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tablespace.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
trigger.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tsearchcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
typecmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
user.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
vacuum.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
vacuumlazy.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
variable.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
view.c Update copyright for 2014 2014-01-07 16:05:30 -05:00