CREATEROLE does not permit commenting on newly-created roles - Mailing list pgsql-bugs

From Owen Jacobson
Subject CREATEROLE does not permit commenting on newly-created roles
Date
Msg-id AANLkTikUMg1VZZ8QoE+kniY8p31k7bmJZ=JB+ABeXLY6@mail.gmail.com
Whole thread Raw
Responses Re: CREATEROLE does not permit commenting on newly-created roles
List pgsql-bugs
Salut,

I'm making use of database-side comments to document the oddities and
intended uses for various database symbols. While this is mostly going
well, it's falling down a bit for documenting role objects. For the
record, I'm running the EnterpriseDB Postgres 9.0.3 package on OS X
10.6 as well as Martin Pitt's Postgres 9.0 PPA on Ubuntu 10.10
(x86_64).

Steps to reproduce:

1. Create a role with CREATEROLE to act as an owner
("comment_createrole" in the repro transcript below).
2. Log in as this role and issue the following statements:

CREATE ROLE commented_role;
COMMENT ON ROLE commented_role IS 'A comment';

Expected results:

The new role has the comment 'A comment' applied to it.

Actual results:

psql:repro.sql:2: ERROR:  must be member of role "commented_role" to
comment upon it

While I realize that roles have no owner, and therefore no obvious
person who should be able to fiddle the comment, being unable to
comment on newly-created roles without joining them really limits the
usefulness of role comments for database administrators. It
intuitively (to me, anyways) feels like CREATEROLE should permit
commenting on (non-superuser) roles.

-o

P.S. A complete reproduction:

$ cat repro.sql
CREATE ROLE commented_role;
COMMENT ON ROLE commented_role IS 'A comment';

$ createdb pg-comment-role
$ psql -U postgres pg-comment-role
psql (9.0.3)
Type "help" for help.

pg-comment-role=# CREATE ROLE comment_createrole WITH LOGIN CREATEROLE
PASSWORD 'comment_createrole';
CREATE ROLE

pg-comment-role=# \q
$ psql -h localhost -U comment_createrole pg-comment-role
psql (9.0.3)
Type "help" for help.

pg-comment-role=> \i repro.sql
CREATE ROLE
psql:repro.sql:2: ERROR:  must be member of role "commented_role" to
comment upon it

pgsql-bugs by date:

Previous
From: SandraA
Date:
Subject: Re: BUG #5899: Memory corruption when running psql
Next
From: Mark Kirkwood
Date:
Subject: Re: Hung Vacuum in 8.3