Re: Residual cleanups for tied objects in PL/Perl

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: andrew(at)dunslane(dot)net, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Residual cleanups for tied objects in PL/Perl
Date: 2026-08-17 06:05:56
Message-ID: CAB8bMivZFmWh9vvkF5HBT+Cy9y=nA2NbGhxQapGPUaZ-mNerSA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

пн, 17 авг. 2026 г. в 03:24, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>:

> The first patch tries to close every Perl-to-SQL path that still
> ignored FETCH on tied values.
>
> I have attached v2.

The previous version missed a few GETMAGIC call sites:
get_perl_array_ref(), the trigger return value, $_TD->{new} before
the SvOK() / SvROK() checks, and the start of return_next(). A tied
scalar whose FETCH returns an arrayref or a hashref still looked like
undef.

That also made the SETOF walker cleaner. The loop only walks with
av_len() and calls return_next(). FETCH lives in return_next() and
plperl_sv_to_datum(), so the loop does not run GETMAGIC on each
element itself.

The regress patch covers those cases. tied_scalar_setof and
tied_scalar_int_array wrap an arrayref in a tied scalar. tied_modify
uses tied scalars for $_TD->{new} and for the "MODIFY" return.

--
Regards,
Rachitskiy Andrey

Attachment Content-Type Size
v2-0002-Add-regress-tests-for-tied-Perl-hashes-and-arrays.patch text/x-patch 14.1 KB
v2-0001-Honor-Perl-FETCH-for-tied-hashes-and-arrays.patch text/x-patch 5.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message solai v 2026-08-17 06:12:37 Re: Add XMLNamespaces to XMLElement
Previous Message Sergey Soloviev 2026-08-17 06:01:31 Re: [PATCH] Do not flush BufFile for regular temp files