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


Reply via email to