pgsql: Tighten array dimensionality checks in Python -> SQL array conve

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Tighten array dimensionality checks in Python -> SQL array conve
Date: 2023-05-04 15:00:53
Message-ID: [email protected]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten array dimensionality checks in Python -> SQL array conversion.

Like plperl before f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.

Some of this behavior was unreachable (without risking a crash)
before 81eaaf65e. It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.

Per bug #17912 and further testing by Alexander Lakhin.

Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9d517339e9912d8e4afe76e26f9a0e5dc54f6f4e

Modified Files
--------------
src/pl/plpython/expected/plpython_types.out | 65 +++++++-
src/pl/plpython/expected/plpython_types_3.out | 65 +++++++-
src/pl/plpython/plpy_typeio.c | 218 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql | 50 +++++-
4 files changed, 270 insertions(+), 128 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-05-04 15:00:54 pgsql: Tighten array dimensionality checks in Python -> SQL array conve
Previous Message Alvaro Herrera 2023-05-04 10:10:48 pgsql: Revert "Move PartitionPruneInfo out of plan nodes into PlannedSt