
Dear developers,

As I'm managing accounts for students... I noticed that there does not 
seem to be a proper way to keep a comment about a postgresql user account, 
such as the full name of the student or its email, that I could see with 
\du or some system query. My solution is to keep the "mapping" somewhere 
else, but having that in the database directly, just like the gecos field 
in a unix password file, would help managing the stuff.

Thus I would suggest to add one new text field in pg_group and pg_shadow 
for this purpose, that could be initialized with something like:

 	CREATE USER calvin COMMENT 'Calvin <calvin@comics.org>';

Alternatively, it could be managed with "COMMENT ON ..."? Well, users or 
groups are not really database objects... so it does not really fit.

If there is some kind of agreement about this, maybe it could be added to 
the todo list for 8.1 (or later;-)?

Have a nice day,

-- 
Fabien.

Wed, 22 Sep 2004 13:15:42 +0200 (CEST)
Fabien COELHO <coelho@cri.ensmp.fr>
todo: comment field for pg users and groups
On Wed, Sep 22, 2004 at 01:15:42PM +0200, Fabien COELHO wrote:

> As I'm managing accounts for students... I noticed that there does not 
> seem to be a proper way to keep a comment about a postgresql user account, 
> such as the full name of the student or its email, that I could see with 
> \du or some system query. My solution is to keep the "mapping" somewhere 
> else, but having that in the database directly, just like the gecos field 
> in a unix password file, would help managing the stuff.
> 
> Thus I would suggest to add one new text field in pg_group and pg_shadow 
> for this purpose, that could be initialized with something like:
> 
> 	CREATE USER calvin COMMENT 'Calvin <calvin@comics.org>';
> 
> Alternatively, it could be managed with "COMMENT ON ..."? Well, users or 
> groups are not really database objects... so it does not really fit.

One problem is that pg_comment, where comments are held, is not a shared
relation.  So if comments are stored there, they would not show up in
other databases if you change, drop or add them.  The same applies to
databases and tablespaces, and that's why there's a warning emitted when
you add a comment to a database.

There have been noises of adding a new catalog for keeping comments for
shared objects (which would itself be shared, of course).  I'm not sure
what the rationale is for not putting them in the pg_shadow catalog.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"There was no reply" (Kernel Traffic)


Wed, 22 Sep 2004 09:04:24 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: todo: comment field for pg users and groups

Dear Alvaro,

>> Thus I would suggest to add one new text field in pg_group and pg_shadow
>> for this purpose, that could be initialized with something like:
>>
>> 	CREATE USER calvin COMMENT 'Calvin <calvin@comics.org>';
>>
>> Alternatively, it could be managed with "COMMENT ON ..."? Well, users or
>> groups are not really database objects... so it does not really fit.
>
> One problem is that pg_comment, where comments are held, is not a shared
> relation.  So if comments are stored there, they would not show up in
> other databases if you change, drop or add them.

Ok. This is the rationnal for users not to have comments.

> The same applies to databases and tablespaces, and that's why there's a 
> warning emitted when you add a comment to a database.

Argh... Indeed non-shared comments on shared objects are not so useful.

> There have been noises of adding a new catalog for keeping comments for
> shared objects (which would itself be shared, of course). I'm not sure
> what the rationale is for not putting them in the pg_shadow catalog.

Well, if there is a "shared" comment infrastructure that would be nice 
indeed. I now see the todo item about "shared" comments. So the todo
is not needed... but just the implementation!

Thanks for your answer,

-- 
Fabien Coelho - coelho@cri.ensmp.fr

Wed, 22 Sep 2004 16:11:36 +0200 (CEST)
Fabien COELHO <coelho@cri.ensmp.fr>
Re: todo: comment field for pg users and groups
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> There have been noises of adding a new catalog for keeping comments for
> shared objects (which would itself be shared, of course).  I'm not sure
> what the rationale is for not putting them in the pg_shadow catalog.

The fact that it wouldn't scale conveniently to handle the other N types
of shared objects...

			regards, tom lane

Wed, 22 Sep 2004 10:32:07 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: todo: comment field for pg users and groups 
> There have been noises of adding a new catalog for keeping comments for
> shared objects (which would itself be shared, of course).  I'm not sure
> what the rationale is for not putting them in the pg_shadow catalog.

Does TOAST work on shared objects?


Wed, 22 Sep 2004 10:44:13 -0400
Rod Taylor <pg@rbt.ca>
Re: todo: comment field for pg users and groups