CREATEROLE does not permit commenting on newly-created roles

From: Owen Jacobson <owen(dot)jacobson(at)grimoire(dot)ca>
To: pgsql-bugs(at)postgresql(dot)org
Subject: CREATEROLE does not permit commenting on newly-created roles
Date: 2011-03-07 19:53:07
Message-ID: AANLkTikUMg1VZZ8QoE+kniY8p31k7bmJZ=JB+ABeXLY6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mark Kirkwood 2011-03-07 23:55:36 Re: Hung Vacuum in 8.3
Previous Message Tom Lane 2011-03-07 17:20:43 Re: Missing Bug-Report #5904?