Re: [HACKERS] create/alter user extension syntax - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] create/alter user extension syntax
Date
Msg-id 383610C0.F9BA9F1D@alumni.caltech.edu
Whole thread Raw
In response to create/alter user extension syntax  (Peter Eisentraut <peter_e@gmx.net>)
List 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@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Createdb problem report
Next
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] 7.0 status request