pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix more issues with extended statistics on expressions 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4f89416c9dbc78da5679d32072315af56fbeb8ed Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4b93eec05e63f2195eb2a673f706cfd1c4dc7a2c Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8b517a30c832d2614d00e1dbe53fe06216adf548 Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0cea8f85ecd001a0488654f3490b9e7d3081b6b8 Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b2ca62b1c069616302b5f9b4d1eb92cd628ea111 Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-10-30 08:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-10-30 08:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6ffd2f91b7400780f146d349dfa31ef3e603c5bb Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix more issues with extended statistics on expressions @ 2026-11-08 21:30 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2026-11-08 21:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix more issues with extended statistics on expressions When evaluating expressions (through make_build_data()) and building stats data for expressions (through build_expr_data()), both routines forgot that examine_expression() could return a NULL result, depending on the data generated by the typanalyze function assigned to a type. This would crash the server. This commit includes some tests added to test_custom_types that are able to reproduce all these issues with two fancy typanalyze callbacks: - False result with a valid stats target, for the expression evaluation. - False result with a valid stats target on second call, for the stats data build. No typanalyze callback in core have the idea to do that, and I doubt that anything out there has the idea to do that. If they do, this switches the expression stats to fail gracefully instead of crashing, based on the combinations that are assumed as supported by the core code. This is a continuation of 3b7a6fa15720. Reported-by: Yuelin Wang <1217816127@qq.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/19763-14da3f96c02f07e8@postgresql.org Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4bcd0d31c6878b370cac8c738a35bb7bc5db22c5 Modified Files -------------- src/backend/statistics/extended_stats.c | 48 ++++++++++++++++++---- src/test/modules/test_custom_types/README | 4 ++ .../expected/test_custom_types.out | 36 ++++++++++++++++ .../test_custom_types/sql/test_custom_types.sql | 28 +++++++++++++ .../test_custom_types/test_custom_types--1.0.sql | 16 ++++++++ .../modules/test_custom_types/test_custom_types.c | 37 +++++++++++++++++ 6 files changed, 161 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-11-08 21:30 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-10-30 08:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz> 2026-11-08 21:30 pgsql: Fix more issues with extended statistics on expressions Michael Paquier <michael@paquier.xyz>
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