Skip site navigation (1) Skip section navigation (2)

Duplicate node tag assignments

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Duplicate node tag assignments
Date: 2016-12-28 16:33:31
Message-ID: 29670.1482942811@sss.pgh.pa.us (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
By chance I happened to notice that the recent partition patch pushed
us over the number of available node tags between

	T_A_Expr = 900,

and

	T_TriggerData = 950,		/* in commands/trigger.h */

Specifically we now have some of the replication grammar node type
codes conflicting with some of the "random other stuff" tags.
It's not terribly surprising that that hasn't caused visible problems,
because of the relatively localized use of replication grammar nodes,
but it's still a Bad Thing.  And it's especially bad that apparently
no one's compiler has complained about it.

So we need to renumber enum NodeTag a bit, which is no big deal,
but I think we had better take thought to prevent a recurrence
(which might have worse consequences next time).

One idea is to add StaticAsserts someplace asserting that there's
still daylight at each manually-assigned break in the NodeTag list.
But I'm not quite sure how to make that work.  For example, asserting
that T_PlanInvalItem < T_PlanState won't help if people add new nodes
after PlanInvalItem and don't think to update the Assert.

Or we could just abandon the manually-assigned breaks in the list
altogether, and let NodeTags run from 1 to whatever.  This would
slightly complicate debugging, in that the numeric values of node
tags would change more than they used to, but on the whole that does
not sound like a large problem.  When you're working in gdb, say,
it's easy enough to convert:

(gdb) p (int) T_CreateReplicationSlotCmd
$8 = 950
(gdb) p (enum NodeTag) 949
$9 = T_BaseBackupCmd

So I'm leaning to the second, more drastic, solution.  Thoughts?

			regards, tom lane


Responses

pgsql-hackers by date

Next:From: Andres FreundDate: 2016-12-28 16:37:39
Subject: Re: Duplicate node tag assignments
Previous:From: Pavel StehuleDate: 2016-12-28 16:01:16
Subject: Re: proposal: session server side variables

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group