create database problematic;
\c problematic

-- create three roles
create role usr;
create role adm;
create role new_adm;

create table foo (bar integer);
alter table foo owner to adm;

grant select(bar) on foo to usr;

-- all ok so far, usr and adm are referenced in
-- the foo.bar column privileges

\dp foo

-- now change the owner
alter table foo owner to new_adm;

-- the following drop succeds, although role adm
-- is still referenced in the foo.bar column
-- privileges.  this is a bug.

drop role adm;

\dp foo

-- the column privileges can now not be changed
-- due to the stale reference to the deleted role.

revoke select(bar) on foo from usr;

\dp foo

\c template1
drop database problematic;

