Unexpected message in grant/revoke script

From: "Webb Sprague" <webb(dot)sprague(at)gmail(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Unexpected message in grant/revoke script
Date: 2008-03-14 17:03:19
Message-ID: b11ea23c0803141003x71e5486fraf28c489a532e2e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have the following function:

create function new_student (text) returns text as $$
declare
wtf integer := 1;
begin
execute 'create schema ' || $1;
execute 'create role ' || $1 || 'LOGIN';
execute 'revoke all on schema public from ' || $1;
execute 'grant select on schema public to ' || $1;
execute 'grant all on schema ' || $1 || ' to ' || $1 || '
with grant option';
return $1;
end;
$$ language plpgsql
;

When I run this with select new_student('foobar'), I get the following
error message

Browse pgsql-general by date

  From Date Subject
Next Message David Wall 2008-03-14 17:07:07 Re: postgre vs MySQL
Previous Message Webb Sprague 2008-03-14 17:00:05 Unexpected error in grant/revoke script