Andres Freund <and...@anarazel.de> writes: > On 2017-09-15 10:33:37 -0400, Tom Lane wrote: >> I don't much like your proposed comment; the only way that this code >> is even approximately correct is if we're exiting the process and >> will never touch the RecordCacheArray again. (Otherwise, it risks >> reassigning a previously used local typmod.)
> How'd it reuse it after running the detach hook in workers? Resetting NextRecordTypmod to zero means that we could reuse a typmod that was previously used. Maybe that's safe because no memory of the old record definition exists anywhere else in the process, but I'm not exactly convinced of that. For that matter, I'm not exactly convinced that nothing else is holding on to an actual pointer to the record tupdesc, making it moot whether or not we flush typcache.c's pointer. (I'm pretty sure that plpgsql, for one, might hold onto tupdesc pointers it gets from the typcache. That's why they have refcounts in the first place.) There's never previously been any expectation that record typmod registrations weren't good for the life of the process, so I don't trust any of the assumptions this code wants to make. It's moot as long as we're not reusing workers, anyway: nothing is going to touch any of the record-tupdesc data before process exit. regards, tom lane -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers