Re: [HACKERS] create/alter user extension syntax

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] create/alter user extension syntax
Date: 1999-11-20 03:08:48
Message-ID: 383610C0.F9BA9F1D@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I tried the following:
> {CREATE|ALTER} USER username
> [ WITH ID/UID/<whatever> number ]
> [ WITH PASSWORD password ]
> [ etc. as usual ]
> which gives shift/reduce conflicts, even if I make PASSWORD and
> ID/whatever a pure keyword (WITH is already one). So that won't work.

Sure it will (well, probably ;)

It depends how you set up the syntax. If you just try to have
something like (pseudocode, I'm rushing to leave for the weekend)

createuser: CREATE USER ColId Qual {};

Qual: WITH ID number {}
| WITH PASSWORD password {};

then the single-token lookahead of yacc will get in trouble. But if
you break it up some more then yacc can start maintaining multiple
token pointers to keep going, and the shift/reduce conflicts will go
away. Something like

cu: CREATE USER ColId QualClause {};

QualClause: QualClause WITH QualExpr {};
| QualClause {}
| /*EMPTY*/ {};

might do the trick, though I might be omitting one level. Check gram.y
for similar syntax examples such as the column qualifiers for CREATE
TABLE (though those are a bit more involved than this probably needs).

Good luck, and I'll be happy to help in a few days if you want.

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-11-20 03:13:36 Re: [HACKERS] 7.0 status request
Previous Message Peter Eisentraut 1999-11-20 02:56:19 Re: [HACKERS] 7.0 status request