Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm()
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>, exclusion@gmail.com,
pgsql-bugs@lists.postgresql.org
Date: 2023-06-29T20:30:21Z
Lists: pgsql-bugs
On 2023-06-29 Th 15:25, Tom Lane wrote: > Andrew Dunstan<andrew@dunslane.net> writes: >> On 2023-06-29 Th 10:26, Tom Lane wrote: >>> 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). >> re relfilenode: we don't have it in getmissingattr, so that would >> involve looking it up or whacking around the API. > Yeah, I was afraid of that. > >> re invalidation: that seems to suggest that the missing value could >> change under us. I don't think it can, but if it can then more than just >> this is broken. If not, how would invalidation affect us? > The scenario I'm afraid of is that we cache a missingval for table X, > then X gets dropped, then a new table Y gets created that by bad luck > has the same type OID as X did, then we add a column to Y that > requires a missingval, and now we have an entry in the hashtable that > matches Y but contains the wrong value. Admittedly, it seems very > low probability that this would all happen within the span of one > transaction, so maybe we can get away with ignoring the case. But > if we used relfilenode, we'd have at least a little more protection > because of the tombstone files that prevent immediate re-use of a > relfilenode OID. I'm not sure that it'd be bulletproof even with > relfilenode, though. Maybe we should bite the bullet and provide > invalidation based on a pg_type inval callback. > > Yeah, Robert has just convinced me, so I'll do it like that. It doesn't look too hard. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com
Commits
-
Cache by-reference missing values in a long lived context
- 2d13dab048a7 11.22 landed
- f938acd68b08 16.0 landed
- a68458108512 17.0 landed
- 75f323aa1c1e 15.5 landed
- 7f4515a58ebd 14.10 landed
- 1bb619d4d628 13.13 landed
- 01993ac748fd 12.17 landed
-
Fix order of operations in ExecEvalFieldStoreDeForm().
- d0ab203bc192 13.12 landed
- cc8cca3c2d60 15.4 landed
- 7f11b7a9cf18 11.21 landed
- 53b93e853ffe 12.16 landed
- 43af714defa0 16.0 landed
- 0789b82a9792 14.9 landed