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: In hstore_plpython, avoid crashing when return value isn't a map
Date: Thu, 27 Apr 2023 15:55:25 +0000
Message-ID: <E1ps3xs-005Be7-Bn@gemulon.postgresql.org> (raw)

In hstore_plpython, avoid crashing when return value isn't a mapping.

Python 3 changed the behavior of PyMapping_Check(), breaking the
test in plpython_to_hstore() that verifies whether a function result
to be transformed is acceptable.  A backwards-compatible fix is to
first verify that the object doesn't pass PySequence_Check().

Perhaps accidentally, our other uses of PyMapping_Check() already
follow uses of PySequence_Check(), so that no other bugs were
created by this change.

Per bug #17908 from Alexander Lakhin.  Back-patch to all supported
branches.

Dmitry Dolgov and Tom Lane

Discussion: https://postgr.es/m/17908-3f19a125d56a11d6@postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/85ec8bcce2608b8e29a1a0742282d39b29b78dda

Modified Files
--------------
contrib/hstore_plpython/expected/hstore_plpython.out | 11 +++++++++++
contrib/hstore_plpython/hstore_plpython.c            |  8 +++++++-
contrib/hstore_plpython/sql/hstore_plpython.sql      | 11 +++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1ps3xs-005Be7-Bn@gemulon.postgresql.org>
Permalink:  ../E1ps3xs-005Be7-Bn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ps3xs-005Be7-Bn@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: In hstore_plpython, avoid crashing when return value isn't a map
  In-Reply-To: <E1ps3xs-005Be7-Bn@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