"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