pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Store empty stavalues when needed for expression statistics.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Store empty stavalues when needed for expression statistics.
@ 2026-11-11 16:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-11-11 16:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Store empty stavalues when needed for expression statistics.

Commit 261f89a97 changed the API contract for update_attstats()
to store an empty array, not a NULL, if it's passed a nonnull
stavalues pointer along with a zero values count.  We missed
that serialize_expr_stats() needs to be kept in sync with that,
so that now we get "unexpected null value" errors if statistics
on an expression hit one of the cases where the statistics
collection code requests that.

Rather than just adjusting serialize_expr_stats() to match, let's
avoid having duplicated code at all, by factoring out a routine
to build a pg_statistic tuple from a VacAttrStats structure.

Bug: #19849
Reported-by: Atish Prakash <125atishprak@gmail.com>
Author: Atish Prakash <125atishprak@gmail.com>
Co-authored-by: Shihao Zhong <zhong950419@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19849-38b8bd2fea807154@postgresql.org
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/44cf2892bbfa2fe7ece791adb072edecf56af365

Modified Files
--------------
src/backend/commands/analyze.c          | 201 ++++++++++++++++++--------------
src/backend/statistics/extended_stats.c |  85 +-------------
src/include/commands/vacuum.h           |   4 +
src/test/regress/expected/stats_ext.out |  18 +++
src/test/regress/sql/stats_ext.sql      |  10 ++
5 files changed, 151 insertions(+), 167 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Store empty stavalues when needed for expression statistics.
@ 2026-11-11 16:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-11-11 16:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Store empty stavalues when needed for expression statistics.

Commit 261f89a97 changed the API contract for update_attstats()
to store an empty array, not a NULL, if it's passed a nonnull
stavalues pointer along with a zero values count.  We missed
that serialize_expr_stats() needs to be kept in sync with that,
so that now we get "unexpected null value" errors if statistics
on an expression hit one of the cases where the statistics
collection code requests that.

Rather than just adjusting serialize_expr_stats() to match, let's
avoid having duplicated code at all, by factoring out a routine
to build a pg_statistic tuple from a VacAttrStats structure.

Bug: #19849
Reported-by: Atish Prakash <125atishprak@gmail.com>
Author: Atish Prakash <125atishprak@gmail.com>
Co-authored-by: Shihao Zhong <zhong950419@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19849-38b8bd2fea807154@postgresql.org
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/commands/analyze.c          | 201 ++++++++++++++++++--------------
src/backend/statistics/extended_stats.c |  85 +-------------
src/include/commands/vacuum.h           |   4 +
src/test/regress/expected/stats_ext.out |  18 +++
src/test/regress/sql/stats_ext.sql      |  10 ++
5 files changed, 151 insertions(+), 167 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-11-11 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 16:04 pgsql: Store empty stavalues when needed for expression statistics. Tom Lane <tgl@sss.pgh.pa.us>
2026-11-11 16:04 pgsql: Store empty stavalues when needed for expression statistics. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox