Re: Is custom MemoryContext prohibited?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Kohei KaiGai <kaigai(at)heterodb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is custom MemoryContext prohibited?
Date: 2020-02-05 17:15:43
Message-ID: 8024.1580922943@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I don't disagree with the factual statements that you are making but I
> don't understand why any of them represent real problems.

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.

The point of the magic number, AIUI, is so that we can still have an
equivalent of Assert(IsA(MemoryContext)) in the code in appropriate
places. That need doesn't require readability in a debugger, which is
why I'm okay with it being a random magic number. But there's still
a need for debugger-friendliness, and a constant string that you need
to use extra commands to see doesn't solve that end of the problem.
IMO anyway.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2020-02-05 17:22:59 Re: pgsql: Prevent running pg_basebackup as root
Previous Message Mark Dilger 2020-02-05 17:03:43 Re: [HACKERS] advanced partition matching algorithm for partition-wise join