Thread: "sql_features" does not exist( Very Urgent)

"sql_features" does not exist( Very Urgent)

From
Date:
<font size="2"><p>Hai,<p>  I create a plpgsql function for grant rights for the postgres users.  The same function is
workingproperly in the previous versions. But it gives the following error message.<p>// Error Message given by the
postgres<p>ERROR: relation "sql_features" does not exist<br />CONTEXT:  PL/pgSQL function "unlockuser" line 6 at
executestatement<p>//***********<p>//******** Function i created ****************<p>create or replace function
unlockuser(name)returns integer as'<p>declare<p>usrname alias for $1;<p>tablelist record;<p>begin<p>for tablelist in
select* from pg_tables where tablename not like ''pg_%'' and tablename not like ''pb%'' order by tablename
loop<p>execute''grant all on ''|| quote_ident(tablelist.tablename)<p>||'' to ''|| usrname;<p>end loop;<p>if not found
then<p>return0;<p>end if;<p>for tablelist in select * from pg_views where viewname not like ''pg_%'' order by viewname
loop<p>execute''grant all on ''|| quote_ident(tablelist.viewname)||'' to ''|| usrname;<p>end loop;<p>if not found
then<p>return0;<p>end if;<p>for tablelist in select * from pg_statio_user_sequences order by relname loop<p>execute
''grantall on ''|| quote_ident(tablelist.relname)||'' to ''|| usrname;<p>end loop;<p>if not found then<p>return
0;<p>endif;<p>return 1;<p>end;<p>'language 'plpgsql';<p>// ****************** *****************<p>Thanks in
advance</font><br/> 

Re: "sql_features" does not exist( Very Urgent)

From
Stephan Szabo
Date:
On Thu, 26 Feb 2004 rajaguru@rajahsoft.net wrote:

>   I create a plpgsql function for grant rights for the postgres users.
> The same function is working properly in the previous versions. But it
> gives the following error message.

You're not putting in the schema names in your grant statements so things
in schemas that are not part of your search path fail (and it would do the
wrong thing for tables hidden by other tables earlier in your search
path I believe).