Re: privileges regression problem on freebsd/alpha

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: privileges regression problem on freebsd/alpha
Date: 2002-03-08 07:21:05
Message-ID: 11914.1015572065@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Yep, tried it again and everything passes.

Bingo.

>> I'm betting this is not a platform issue, but just aclchk.c being out
>> of sync with the parser. GrantStmt is using parser token codes to
>> distinguish the various kinds of GRANT, which is probably a bad idea.
>> The token codes will change anytime someone looks crosseyed at gram.y
>> (well, I exaggerate, but they're not exactly stable). IMHO node
>> structure definitions shouldn't depend on them.

Looking around finds these places where parser token codes are used
beyond the parser itself:

aclchk.c: GrantStmt
command.c: AlterTableDropConstraint
comment.c: CommentObject, CommentRelation
postgres.c: TransactionStmt
utility.c: TransactionStmt, FetchStmt, CopyStmt, DefineStmt, ReindexStmt

(I exclude _outAExpr in outfuncs.c, which is okay since it's effectively
only used for debugging dumps.)

I believe these are all trouble waiting to happen --- for example,
if utility.o is out of sync with the parser, a COPY command could be
interpreted as going in the wrong direction :-(. The risk would be
completely intolerable if any of these commands were allowed in stored
rules, since the rule parsetree would outlive any one compilation of the
backend. Currently that's not true, but they might be allowed sometime.

Barring strenuous objections from someplace, I plan to change these node
types to use booleans or special-purpose enum fields as appropriate.
That will make their representation independent of what the parser token
set happens to be on any given day. We should avoid re-introducing such
dependencies in future.

Comments?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Bazin 2002-03-08 07:35:18 Additional fixes to ecpg - please apply patch
Previous Message Adam Wyard 2002-03-08 06:59:25 Update 6.5 database files to 7.0