"sql_features" does not exist( Very Urgent)

Поиск
Список
Период
Сортировка
Искать

"sql_features" does not exist( Very Urgent)

От:
<rajaguru@rajahsoft.net>
Дата:

Hai,

  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.

// Error Message given by the postgres

ERROR:  relation "sql_features" does not exist
CONTEXT:  PL/pgSQL function "unlockuser" line 6 at execute statement

//***********

//******** Function i created ****************

create or replace function unlockuser(name) returns integer as'

declare

usrname alias for $1;

tablelist record;

begin

for tablelist in select * from pg_tables where tablename not like ''pg_%'' and tablename not like ''pb%'' order by tablename loop

execute ''grant all on ''|| quote_ident(tablelist.tablename)

||'' to ''|| usrname;

end loop;

if not found then

return 0;

end if;

for tablelist in select * from pg_views where viewname not like ''pg_%'' order by viewname loop

execute ''grant all on ''|| quote_ident(tablelist.viewname)||'' to ''|| usrname;

end loop;

if not found then

return 0;

end if;

for tablelist in select * from pg_statio_user_sequences order by relname loop

execute ''grant all on ''|| quote_ident(tablelist.relname)||'' to ''|| usrname;

end loop;

if not found then

return 0;

end if;

return 1;

end;

'language 'plpgsql';

// ****************** *****************

Thanks in advance


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

От:
Stephan Szabo <sszabo@megazone.bigpanda.com>
Дата:

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).
FAQ