Sergio Gabriel Rodriguez escribió:
> >
> > Luego de haber echo el cambio que dices, volviste a hacer la prueba que
> > sugiere Alvaro sin ningún problema?
> >
> >
> > >>>> create schema "mi esquema" create table "mi tabla" ();
> > >>>> select dar_permisos("mi esquema", current_user, 'all');
> 
> Si, anduvo bien, mi pregunta apunta a si hay algún otro error que no estoy
> viendo

¿Funciona realmente?  Lo que quería hacerte notar es que debes usar
quote_ident:

CREATE OR REPLACE FUNCTION "public"."dar_permisos" (esquema varchar, usuario 
varchar, privilegio varchar) RETURNS boolean AS
$BODY$
DECLARE
    registro  record;
BEGIN
  FOR registro IN SELECT * FROM pg_tables WHERE schemaname= esquema LOOP
          EXECUTE 'GRANT ' || privilegio || ' ON ' || quote_ident(esquema) || 
'.' ||
quote_ident(registro.tablename) || ' TO ' || quote_ident(usuario);
  END LOOP;
  RETURN TRUE;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE ;


-- 
Alvaro Herrera                  http://www.amazon.com/gp/registry/5ZYLFMCVHXC
"In a specialized industrial society, it would be a disaster
to have kids running around loose." (Paul Graham)
--
TIP 3: Si encontraste la respuesta a tu problema, publícala, otros te lo 
agradecerán

Responder a