Re: BUG #18722: Processing arrays with plpgsql raises errors

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18722: Processing arrays with plpgsql raises errors
Date: 2024-11-25 17:59:05
Message-ID: CAEZATCUvXyCVbXMN8Z3GXn_xooNL+=B4e9G0CADceCoHyu4t-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 25 Nov 2024 at 15:07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> > I don't know about that, but I wonder if this bug could be fixed by
> > having ExecInitExprRec() insert a EEOP_MAKE_READONLY step. Then it
> > wouldn't be necessary to make any changes to the expression evaluation
> > code.
>
> That would entirely destroy one of the primary performance benefits of
> the expanded-object infrastructure. The idea is that if you have
> fconsumer(fproducer(...), ...)
> and fproducer returns a read-write pointer to an object it's built,
> then fconsumer should be able to take ownership of the object and
> use it as a local variable (possibly modifying it) without incurring
> any object-copying overhead.
>
> This works in any context where an intermediate expression value
> has a single consumer, which is most. If there are multiple
> consumers then we need to insert MAKE_READONLY steps for all
> (or all but one) of them. I overlooked EEOP_NULLIF as such
> a case, but I don't think there are so many more cases as to
> justify throwing away the concept altogether.
>

I didn't mean do it in all cases, I just meant the NullIfExpr case
identified here. My point was that instead of modifying the evaluation
code for EEOP_NULLIF to make it call
MakeExpandedObjectReadOnlyInternal(), it would be easier to insert a
EEOP_MAKE_READONLY step for the first argument of the EEOP_NULLIF
step.

Regards,
Dean

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Vallimaharajan G 2024-11-25 18:27:07 [Bug] Heap Use After Free in parallel_vacuum_reset_dead_items Function
Previous Message Tom Lane 2024-11-25 17:53:58 Re: Detection of hadware feature => please do not use signal