Re: MemoryContext and NodeTags - Mailing list pgsql-hackers

From Tom Lane
Subject Re: MemoryContext and NodeTags
Date
Msg-id 22347.1129560125@sss.pgh.pa.us
Whole thread Raw
In response to Re: MemoryContext and NodeTags  (Thomas Hallgren <thomas.hallgren@home.se>)
Responses Re: MemoryContext and NodeTags
List pgsql-hackers
Thomas Hallgren <thomas.hallgren@home.se> writes:
> tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: MemoryContext and NodeTags
Next
From: Tony Caduto
Date:
Subject: More problems with the win32 installer for 8.1 beta3