Skip site navigation (1) Skip section navigation (2)

GRANT SELECT ON table TO $1

From: "David Barajas" <david(at)sonrie(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: GRANT SELECT ON table TO $1
Date: 2006-10-31 03:39:05
Message-ID: 446c20370610301939k7f413569pdb0c939711d3f8ae@mail.gmail.com (view raw or flat)
Thread:
Lists: 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.

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2006-10-31 03:51:59
Subject: Re: GRANT SELECT ON table TO $1
Previous:From: Jim C. NasbyDate: 2006-10-30 15:25:49
Subject: Re: Copying data from table to table (cloned tables)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group