Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEsbS-0000DR-Jf for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Jun 2023 14:26:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qEsbR-0005ii-8r for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Jun 2023 14:26:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEsbR-0005gt-06 for pgsql-bugs@lists.postgresql.org; Thu, 29 Jun 2023 14:26:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qEsbO-0016zy-MT for pgsql-bugs@lists.postgresql.org; Thu, 29 Jun 2023 14:26:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 35TEQOYs1509403; Thu, 29 Jun 2023 10:26:24 -0400 From: Tom Lane To: Andrew Dunstan cc: Andres Freund , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm() In-reply-to: References: <17994-5c7100b51b4790e9@postgresql.org> <1306569.1687978174@sss.pgh.pa.us> <20230628194446.uu47f4vyfyjfl7dd@awork3.anarazel.de> <1314841.1687981948@sss.pgh.pa.us> <20230628205443.6gu5bmcck6t4pgyv@awork3.anarazel.de> Comments: In-reply-to Andrew Dunstan message dated "Thu, 29 Jun 2023 09:56:39 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1509401.1688048784.1@sss.pgh.pa.us> Date: Thu, 29 Jun 2023 10:26:24 -0400 Message-ID: <1509402.1688048784@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > After (not) sleeping on this overnight, and discussing it with a > colleague this morning, here's a suggestion. We have a hash table, keyed > by (tdtypeid, attnum) where we store a datumCopy'd version of the value. > If it's present just return the value instead of getting it from the > tupdesc. The hash table is blown away at the end of the transaction. > Assuming that's workable I think it would not be a large patch. That sounds possibly workable. I'm a bit concerned about added overhead, and about whether the hashtable needs invalidation support. It might be better to key it off (relfilenode, attnum). > My colleague did ask if we had live reproducible case. I have not attempted to build one, but it'd probably be fairly easy to do if you turn on debug_discard_caches. regards, tom lane