for example: ...
If in both examples you replace create role bob; with create role bob SUPERUSER;and in the second example add "set role bob;" before "alter table ..." query, then no error will be occur.
-- With best regards, Dmitry Koval Postgres Professional: http://postgrespro.com