[PATCH v1] plpython: Pair SPI_connect and SPI_finish in the same function

From: Xing Guo <higuoxing(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH v1] plpython: Pair SPI_connect and SPI_finish in the same function
Date: 2026-07-14 08:52:03
Message-ID: CACpMh+DS_uSo-hsh__c91thg7BYXkuv-BPKYpy3oaw0N9xVyGQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While reading PL/Python's source code, I spotted that PL/Python's
call_handler and inline_handler call SPI_connect_ext(), but
SPI_finish() is called inside different execution functions in
plpy_exec.c. It's easy to miss SPI_finish() call when adding a new
execution path for PL/Python.

I created a patch to move these SPI_finish() calls to pair with
SPI_connect in the same function.

Best Regards,
Xing

Attachment Content-Type Size
v1-0001-plpython-pair-SPI_connect-and-SPI_finish-in-the-s.patch application/octet-stream 4.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan Gonzalez V. 2026-07-14 08:53:50 Re: Path Traversal Vulnerability in pg_dump Directory Format
Previous Message Karina Litskevich 2026-07-14 08:44:25 Re: Implicit conversion from int64 to int32 when calling hash_get_num_entries