Re: Using current_database() in a grant

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using current_database() in a grant
Date: 2002-10-20 17:37:01
Message-ID: 13193.1035135421@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> area=# grant create on database current_database() to bruno;
> ERROR: parser: parse error at or near "(" at character 42

GRANT, like essentially all other utility statements, only allows
simple names and literal constants in its parameters. I'm not
excited about trying to generalize that to arbitrary expressions
(or even just function calls), for a couple of reasons:

* probable syntax problems (shift/reduce conflicts), which could only be
resolved by turning lots more keywords into fully-reserved words. The
syntax of the utility commands is pretty irregular and involves lots of
keywords that don't presently have to be reserved because they're not
keywords when used in or near expressions. We'd lose that separation
if we allowed expressions in the utility commands.

* implementation problems and definitional problems in allowing
arbitrary user-defined code to run while a utility command is executed.

You can do what you want to do easily enough with a plpgsql function
containing an EXECUTE command, so I don't see the need to try to
implement it at a lower level ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hunter Hillegas 2002-10-20 19:05:04 Buffers and MacOS X
Previous Message Tom Lane 2002-10-20 17:28:31 Re: Problem granting usage on language c