pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
@ 2022-08-05 17:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-05 17:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

statext_is_compatible_clause_internal() checked that the arguments
of a ScalarArrayOpExpr are one Var and one Const, but it would allow
cases where the Const was on the left.  Subsequent uses of the clause
are not expecting that and would suffer assertion failures or core
dumps.  mcv.c also had not bothered to cope with the case of a NULL
array constant, which seems really unacceptably sloppy of somebody.
(Although our tools failed us there too, since AFAIK neither Coverity
nor any compiler warned of the obvious use-of-uninitialized-variable
condition.)  It seems best to handle that by having
statext_is_compatible_clause_internal() reject it.

Noted while fixing bug #17570.  Back-patch to v13 where the
extended stats code grew some awareness of ScalarArrayOpExpr.

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/statistics/extended_stats.c | 13 +++++++++++--
src/backend/statistics/mcv.c            | 24 +++++++++++-------------
src/test/regress/expected/stats_ext.out | 22 ++++++++++++++++++----
src/test/regress/sql/stats_ext.sql      | 14 ++++++++++----
4 files changed, 50 insertions(+), 23 deletions(-)



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

* pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
@ 2022-08-05 17:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-05 17:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

statext_is_compatible_clause_internal() checked that the arguments
of a ScalarArrayOpExpr are one Var and one Const, but it would allow
cases where the Const was on the left.  Subsequent uses of the clause
are not expecting that and would suffer assertion failures or core
dumps.  mcv.c also had not bothered to cope with the case of a NULL
array constant, which seems really unacceptably sloppy of somebody.
(Although our tools failed us there too, since AFAIK neither Coverity
nor any compiler warned of the obvious use-of-uninitialized-variable
condition.)  It seems best to handle that by having
statext_is_compatible_clause_internal() reject it.

Noted while fixing bug #17570.  Back-patch to v13 where the
extended stats code grew some awareness of ScalarArrayOpExpr.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/94da73281ed93c86d2f286996bcd61d8bfac4ffd

Modified Files
--------------
src/backend/statistics/extended_stats.c | 12 +++++++++---
src/backend/statistics/mcv.c            | 23 ++++++++++-------------
src/test/regress/expected/stats_ext.out | 22 ++++++++++++++++++----
src/test/regress/sql/stats_ext.sql      | 14 ++++++++++----
4 files changed, 47 insertions(+), 24 deletions(-)



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

* pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
@ 2022-08-05 17:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-05 17:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

statext_is_compatible_clause_internal() checked that the arguments
of a ScalarArrayOpExpr are one Var and one Const, but it would allow
cases where the Const was on the left.  Subsequent uses of the clause
are not expecting that and would suffer assertion failures or core
dumps.  mcv.c also had not bothered to cope with the case of a NULL
array constant, which seems really unacceptably sloppy of somebody.
(Although our tools failed us there too, since AFAIK neither Coverity
nor any compiler warned of the obvious use-of-uninitialized-variable
condition.)  It seems best to handle that by having
statext_is_compatible_clause_internal() reject it.

Noted while fixing bug #17570.  Back-patch to v13 where the
extended stats code grew some awareness of ScalarArrayOpExpr.

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/statistics/extended_stats.c | 12 +++++++++---
src/backend/statistics/mcv.c            | 23 ++++++++++-------------
src/test/regress/expected/stats_ext.out | 22 ++++++++++++++++++----
src/test/regress/sql/stats_ext.sql      | 14 ++++++++++----
4 files changed, 47 insertions(+), 24 deletions(-)



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

* pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
@ 2022-08-05 17:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2022-08-05 17:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

statext_is_compatible_clause_internal() checked that the arguments
of a ScalarArrayOpExpr are one Var and one Const, but it would allow
cases where the Const was on the left.  Subsequent uses of the clause
are not expecting that and would suffer assertion failures or core
dumps.  mcv.c also had not bothered to cope with the case of a NULL
array constant, which seems really unacceptably sloppy of somebody.
(Although our tools failed us there too, since AFAIK neither Coverity
nor any compiler warned of the obvious use-of-uninitialized-variable
condition.)  It seems best to handle that by having
statext_is_compatible_clause_internal() reject it.

Noted while fixing bug #17570.  Back-patch to v13 where the
extended stats code grew some awareness of ScalarArrayOpExpr.

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/statistics/extended_stats.c | 12 +++++++++---
src/backend/statistics/mcv.c            | 23 ++++++++++-------------
src/test/regress/expected/stats_ext.out | 22 ++++++++++++++++++----
src/test/regress/sql/stats_ext.sql      | 14 ++++++++++----
4 files changed, 47 insertions(+), 24 deletions(-)



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


end of thread, other threads:[~2022-08-05 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 17:59 pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti Tom Lane <tgl@sss.pgh.pa.us>
2022-08-05 17:59 pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti Tom Lane <tgl@sss.pgh.pa.us>
2022-08-05 17:59 pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti Tom Lane <tgl@sss.pgh.pa.us>
2022-08-05 17:59 pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti 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