Re: MemoryContext and NodeTags

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Hallgren <thomas(dot)hallgren(at)home(dot)se>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MemoryContext and NodeTags
Date: 2005-10-17 14:42:05
Message-ID: 22347.1129560125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Hallgren <thomas(dot)hallgren(at)home(dot)se> writes:
> tgl(at)sss(dot)pgh(dot)pa(dot)us wrote:
>> No. Define 'em yourself.
>>
> OK, I can do that. But I have a couple of reasons why I think that it
> would be a good idea to get my definitions into node.h:
> - If more module authors want to do similar things, they would not risk
> defining overlapping tags.

Only for those module authors who manage to get their tags accepted;
and even for them, only for PG versions later than when they start
working. Not much of an extension mechanism, is it?

> - The NodeTag is an enum. Code that defines tags that are supposed to
> "fit in" becomes ugly.

I don't see anyone trying to "switch" over MemoryContext tags, so this
is really pretty irrelevant. AFAICS it should work just fine to do

#define T_FooNode ((NodeTag) (T_FirstPrivateNode + 1))

> - The IsA macro can be used.

Still can AFAICS --- that macro knows nothing about the enum, just about
the convention that Foo and T_Foo are related names.

> - You (PostgreSQL core) want full control over the tags. If all tags are
> in nodes.h, you can move tags to other number ranges without creating a
> hassle for people like me.

As long as you define your tag as T_Something + N, that still holds.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tony Caduto 2005-10-17 14:52:31 More problems with the win32 installer for 8.1 beta3
Previous Message Thomas Hallgren 2005-10-17 14:29:44 Re: MemoryContext and NodeTags