GRANT SELECT ON table TO $1 - Mailing list pgsql-novice

From David Barajas
Subject GRANT SELECT ON table TO $1
Date
Msg-id 446c20370610301939k7f413569pdb0c939711d3f8ae@mail.gmail.com
Whole thread Raw
Responses Re: GRANT SELECT ON table TO $1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi all,
 
I'm a newbie of PostgreSQL, I have a function like this:

CREATE OR REPLACE FUNCTION func(TEXT)
RETURNS integer
AS $$
BEGIN
  GRANT SELECT ON table1 TO $1;
END;
$$
LANGUAGE 'plpgsql';

and I get something like this:

ERROR:  error de sintaxis en o cerca de «$1» at character 31
QUERY:  GRANT SELECT ON table1 TO  $1
CONTEXT:  SQL statement in PL/PgSQL function "func" near line 7
LINEA 1: GRANT SELECT ON table1 TO  $1

I think that the problem is the data type (TEXT) but I can't find the solution.

Can somebody help me with that problem please.

Thanks.

Sorry for my English.

pgsql-novice by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
Next
From: Tom Lane
Date:
Subject: Re: GRANT SELECT ON table TO $1