pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm()
Date: Mon, 21 Aug 2023 12:04:14 -0400
Message-ID: <7dc0e894-62ff-381c-b633-fa68250dd586@dunslane.net> (raw)
In-Reply-To: <20230821123337.fytudn7wtjlgtttk@alvherre.pgsql>
References: <20230821123337.fytudn7wtjlgtttk@alvherre.pgsql>


On 2023-08-21 Mo 08:33, Alvaro Herrera wrote:
> Hello,
>
> On 2023-Jul-12, Andrew Dunstan wrote:
>
>> +			entry = hash_search(missing_cache, &key, HASH_ENTER, &found);
>> +
>> +			if (!found)
>> +			{
>> +				/* cache miss, so we need a non-transient copy of the datum */
>> +				oldctx = MemoryContextSwitchTo(TopMemoryContext);
>> +				entry->value =
>> +					datumCopy(attrmiss->am_value, false, att->attlen);
>> +				MemoryContextSwitchTo(oldctx);
>> +			}
> Hmm ... when exactly do these values get freed if no longer needed?  Is
> the theory that leaking them is not relevant?


Not sure I understand "relevant" here. They don't get freed. There will 
be at most one entry per row in pg_attribute where atthasmissing is 
true. I originally suggested cleaning them up at transaction end, but 
there was an argument that that might not make them sufficiently 
long-lived, and I don't know of any time more coarse grained when we can 
conveniently clean them up.


cheers


andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

view thread (33+ messages)  latest in thread

Message-ID: <7dc0e894-62ff-381c-b633-fa68250dd586@dunslane.net>
Permalink:  ../7dc0e894-62ff-381c-b633-fa68250dd586@dunslane.net/
Also on:    postgresql.org/message-id/7dc0e894-62ff-381c-b633-fa68250dd586@dunslane.net

 · 

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-bugs@postgresql.org
  Cc: andrew@dunslane.net, alvherre@alvh.no-ip.org, andres@anarazel.de, tgl@sss.pgh.pa.us, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm()
  In-Reply-To: <7dc0e894-62ff-381c-b633-fa68250dd586@dunslane.net>

* 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