pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Tighten array dimensionality checks in Python -> SQL array conve
Date: Thu, 04 May 2023 15:00:54 +0000
Message-ID: <E1puaRx-000STT-HJ@gemulon.postgresql.org> (raw)

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/17912-82ceed78731d9cdc@postgresql.org

Branch
------
REL_11_STABLE

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

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                 | 216 +++++++++++++-------------
src/pl/plpython/sql/plpython_types.sql        |  50 +++++-
4 files changed, 274 insertions(+), 122 deletions(-)



view thread (12+ messages)

Message-ID: <E1puaRx-000STT-HJ@gemulon.postgresql.org>
Permalink:  ../E1puaRx-000STT-HJ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1puaRx-000STT-HJ@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Tighten array dimensionality checks in Python -> SQL array conve
  In-Reply-To: <E1puaRx-000STT-HJ@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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