Re: Parser conflicts in extended GRANT statement

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parser conflicts in extended GRANT statement
Date: 2002-02-16 00:29:04
Message-ID: 16980.1013819344@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Entertaining parser conflicts again.

I agree with sorting out the privileges lists later.

> Attempt 2:

> We set up

> privileges = SELECT | UPDATE | ... | EXECUTE | ALL PRIVILEGES

> grant_table = GRANT privileges ON tablename TO ...

> grant_func = GRANT privileges ON FUNCTION funcname(...) TO ...

> This leads to a shift/reduce conflict at the state

> GRANT privileges ON FUNCTION

> where FUNCTION could be a table name or introducing an actual function
> name.

The trick with this sort of problem is to make sure that the parser
doesn't have to reduce anything until it's seen enough tokens to make
the result unambiguous. You are losing here because the parser has to
decide whether or not to reduce FUNCTION to tablename before it can
see any further than the TO.

I think it might work to do

grant := GRANT privileges ON grant_target TO ...

grant_target := tablename

| FUNCTION funcname(...)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2002-02-16 00:30:07 Re: Maintaining the list of release changes
Previous Message Marc G. Fournier 2002-02-16 00:14:40 Re: Ready to branch 7.2/7.3 ?