Re: GRANT SELECT ON table TO $1
- From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
- To: "David Barajas" <david(at)sonrie(dot)net>
- Cc: pgsql-novice(at)postgresql(dot)org
- Subject: Re: GRANT SELECT ON table TO $1
- Date: Mon, 30 Oct 2006 22:51:59 -0500
- Message-id: <23445(dot)1162266719(at)sss(dot)pgh(dot)pa(dot)us>
"David Barajas" <david(at)sonrie(dot)net> writes:
> CREATE OR REPLACE FUNCTION func(TEXT)
> RETURNS integer
> AS $$
> BEGIN
> GRANT SELECT ON table1 TO $1;
Can't do that: a $-parameter is a placeholder for a data value, not a
name, and GRANT wants a name. You could do
EXECUTE 'GRANT SELECT ON table1 TO ' || quote_ident($1);
regards, tom lane
Home |
Main Index |
Thread Index