On Wed, Feb 5, 2020 at 12:15 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > The core problem that I'm unhappy about is that what you want to do > adds cognitive burden (including an increased risk of mistakes) and > extra debugging commands in common cases around inspecting memory > contexts in a debugger. Sure, it's not a fatal problem, but it's > still a burden. I judge that putting an enum into the struct would > greatly reduce that burden at very small cost.
I respect that, but I disagree. I think the annoyance and strangeness factor of the enum is pretty high for third-party code that wants to use this, because deliberately concocting an out-of-range value for an enum is really odd. And I think the gain in debuggability is pretty low, because even if the enum seems to have the expected value, you still don't really know that things are OK unless you check the magic number and the methods field, too. On the other hand, I don't inspect memory contexts in a debugger all that often, and it sounds like you do, or you presumably wouldn't feel so strongly about this. We might have to see if anybody else has an opinion. I'd rather do it your way than no way, but I feel like it's such a strange design that I'd be afraid to commit it if anyone other than you had suggested it, for fear of having you demand an immediate revert and, maybe, the removal of some of my less important limbs. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company