Re: Problem with tupdesc in jsonb_to_recordset - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: Problem with tupdesc in jsonb_to_recordset
Date
Msg-id CA+q6zcUhS8Cz8AaVinJ6bjCsCbV3quuZDecJCTrQRu-ptTfcVg@mail.gmail.com
Whole thread Raw
In response to Re: Problem with tupdesc in jsonb_to_recordset  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
> On Wed, 11 Jul 2018 at 08:27, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, Jul 10, 2018 at 10:39:28PM +0200, Dmitry Dolgov wrote:
> > I've found out that currently in some situations jsonb_to_recordset can lead to
> > a crash. Minimal example that I've managed to create looks like this:
>
> It would be better not to send the same email across multiple mailing
> lists.

Ok, sorry - next time I'll avoid this.

> On Wed, Jul 11, 2018 at 03:27:13PM +0900, Michael Paquier wrote:
> > I don't think that your solution is correct.  From my read of 37a795a6,
> > the tuple descriptor is moved from the query-lifespan memory context
> > (ecxt_per_query_memory) to a function-level context, which could cause
> > the descriptor to become busted as your test is pointing out.  Tom?
>
> Hacking my way out I am finishing with the attached, which fixes the
> problem and passes all regression tests.  I am not completely sure that
> this the right approach though, I would need to think a bit more about
> it.

So, you removed FreeTupleDesc call - does it mean, that if io->tupdesc will not
be reset in some other situations it's going to be a memory leak?


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Negotiating the SCRAM channel binding type
Next
From: Ashutosh Bapat
Date:
Subject: partition pruning doesn't work with IS NULL clause in multikey rangepartition case