Thread: Comments on roles and tablespaces for pg 8.2+

Comments on roles and tablespaces for pg 8.2+

From
Erwin Brandstetter
Date:
Hi developers!

Testing pgAdmin III 1.8.0  Beta 2 (Jul 25 2007, rev: 6486). Client Win
XP, host: Debian Etch / PG 8.2.4

pg 8.2 has added COMMENTs on two more objects: roles and tablespaces.
    http://www.postgresql.org/docs/8.2/static/sql-comment.html  (compare
with:  http://www.postgresql.org/docs/8.1/static/sql-comment.html)

    COMMENT ON ROLE my_role IS 'Administration group for finance tables';
    COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';

As I have to manage lots of users I find comments on roles especially
useful. pgAdmin, however, does not yet display these in the SQL pane of
the object browser. One might overwrite existing ones by accident, being
mislead into thinking there were none.

There is even a "Comment" field in the properties dialogue for
tablespaces, but it does not display existing comments and you cannot
enter anything, either.
There is no "Comment" field in in the properties dialogue for roles, yet.

I would be content if the comments were shown in the SQL pane. Being
able to edit them via properties dialogue would be a bonus, IMO.


The only new place for comments in pg 8.3 would be this one: (according
to http://developer.postgresql.org/pgdocs/postgres/sql-comment.html)
    OPERATOR FAMILY /object_name/ USING /index_method
/Not sure whether that requires any changes to pgAdmin./
/

For reference:
psql (v 8.2.4) displays the comments. I demonstrate with "psql -E" to
show the used SQL (German version):
There is still  \du+ or \dg+ for users / groups. Both display all roles
these days (they should probably update the docs or, better yet,
substitute \du and \dg with \dr ...)

event=# \du+
******** ANFRAGE *********
SELECT r.rolname AS "Rollenname",
  CASE WHEN r.rolsuper THEN 'ja' ELSE 'nein' END AS "Superuser",
  CASE WHEN r.rolcreaterole THEN 'ja' ELSE 'nein' END AS "Rolle erzeugen",
  CASE WHEN r.rolcreatedb THEN 'ja' ELSE 'nein' END AS "DB erzeugen",
  CASE WHEN r.rolconnlimit < 0 THEN CAST('keine Beschränkung' AS
pg_catalog.text)
       ELSE CAST(r.rolconnlimit AS pg_catalog.text)
  END AS "Verbindungen",
  ARRAY(SELECT b.rolname FROM pg_catalog.pg_auth_members m JOIN
pg_catalog.pg_roles b ON (m.roleid = b.oid) WHERE m.member = r.oid) as
"Mitglied von"
, pg_catalog.shobj_description(r.oid, 'pg_authid') AS "Beschreibung"
FROM pg_catalog.pg_roles r
ORDER BY 1;
**************************

--  tablespaces:
event=# \db+
******** ANFRAGE *********
SELECT spcname AS "Name",
  pg_catalog.pg_get_userbyid(spcowner) AS "Eigentümer",
  spclocation AS "Pfad",
  spcacl as "Zugriffsrechte",
  pg_catalog.shobj_description(oid, 'pg_tablespace') AS "Beschreibung"
FROM pg_catalog.pg_tablespace
ORDER BY 1;
**************************


Regards
Erwin

Re: Comments on roles and tablespaces for pg 8.2+

From
"Hiroshi Saito"
Date:
Hi.

Yes!, Only the tablespace was fixed. However, Role also includes a design,
please wait for it for a while.  Thanks!

Regards,
Hiroshi Saito

----- Original Message -----
From: "Erwin Brandstetter" <brandstetter@falter.at>
To: <pgadmin-hackers@postgresql.org>
Sent: Thursday, August 02, 2007 5:08 AM
Subject: [pgadmin-hackers] Comments on roles and tablespaces for pg 8.2+


> Hi developers!
>
> Testing pgAdmin III 1.8.0  Beta 2 (Jul 25 2007, rev: 6486). Client Win XP, host: Debian
> Etch / PG 8.2.4
>
> pg 8.2 has added COMMENTs on two more objects: roles and tablespaces.
>    http://www.postgresql.org/docs/8.2/static/sql-comment.html  (compare with:
> http://www.postgresql.org/docs/8.1/static/sql-comment.html)
>
>    COMMENT ON ROLE my_role IS 'Administration group for finance tables';
>    COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';
>
> As I have to manage lots of users I find comments on roles especially useful. pgAdmin,
> however, does not yet display these in the SQL pane of the object browser. One might
> overwrite existing ones by accident, being mislead into thinking there were none.
>
> There is even a "Comment" field in the properties dialogue for tablespaces, but it does
> not display existing comments and you cannot enter anything, either.
> There is no "Comment" field in in the properties dialogue for roles, yet.
>
> I would be content if the comments were shown in the SQL pane. Being able to edit them via
> properties dialogue would be a bonus, IMO.
>
>
> The only new place for comments in pg 8.3 would be this one: (according to
> http://developer.postgresql.org/pgdocs/postgres/sql-comment.html)
>    OPERATOR FAMILY /object_name/ USING /index_method
> /Not sure whether that requires any changes to pgAdmin./
> /
>
> For reference:
> psql (v 8.2.4) displays the comments. I demonstrate with "psql -E" to show the used SQL
> (German version):
> There is still  \du+ or \dg+ for users / groups. Both display all roles these days (they
> should probably update the docs or, better yet, substitute \du and \dg with \dr ...)
>
> event=# \du+
> ******** ANFRAGE *********
> SELECT r.rolname AS "Rollenname",
>  CASE WHEN r.rolsuper THEN 'ja' ELSE 'nein' END AS "Superuser",
>  CASE WHEN r.rolcreaterole THEN 'ja' ELSE 'nein' END AS "Rolle erzeugen",
>  CASE WHEN r.rolcreatedb THEN 'ja' ELSE 'nein' END AS "DB erzeugen",
>  CASE WHEN r.rolconnlimit < 0 THEN CAST('keine Beschränkung' AS pg_catalog.text)
>       ELSE CAST(r.rolconnlimit AS pg_catalog.text)
>  END AS "Verbindungen",
>  ARRAY(SELECT b.rolname FROM pg_catalog.pg_auth_members m JOIN pg_catalog.pg_roles b ON
> (m.roleid = b.oid) WHERE m.member = r.oid) as "Mitglied von"
> , pg_catalog.shobj_description(r.oid, 'pg_authid') AS "Beschreibung"
> FROM pg_catalog.pg_roles r
> ORDER BY 1;
> **************************
>
> --  tablespaces:
> event=# \db+
> ******** ANFRAGE *********
> SELECT spcname AS "Name",
>  pg_catalog.pg_get_userbyid(spcowner) AS "Eigentümer",
>  spclocation AS "Pfad",
>  spcacl as "Zugriffsrechte",
>  pg_catalog.shobj_description(oid, 'pg_tablespace') AS "Beschreibung"
> FROM pg_catalog.pg_tablespace
> ORDER BY 1;
> **************************
>
>
> Regards
> Erwin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org


Re: Comments on roles and tablespaces for pg 8.2+

From
Erwin Brandstetter
Date:
Hi developers! Hi Hiroshi-san!
z-saito@guitar.ocn.ne.jp wrote:
> Hi.
>
> Yes!, Only the tablespace was fixed. However, Role also includes a
> design,
> please wait for it for a while.  Thanks!

In beta 3 the comments on role and tablespace seem to work fine!
However, the new controls also show up for older versions < 8.2 (tested
with 8.1.8), resulting in errors when used.


Another (maybe unrelated?) peculiarity (pg 8.1 and 8.2), this is what I
get in the SQL pane for a tablespace:
Note the three blank lines, where I would expect:
-- DROP TABLESPACE test;

=== quote
-- Tablespace: "test"



CREATE TABLESPACE test
  OWNER postgres
  LOCATION '/var/lib/postgres/test';
COMMENT ON TABLESPACE test IS 'Test.
Test.';
=== quote end



Regards
Erwin

Re: Comments on roles and tablespaces for pg 8.2+

From
Dave Page
Date:
Erwin Brandstetter wrote:
> In beta 3 the comments on role and tablespace seem to work fine!
> However, the new controls also show up for older versions < 8.2 (tested
> with 8.1.8), resulting in errors when used.
>
> Another (maybe unrelated?) peculiarity (pg 8.1 and 8.2), this is what I
> get in the SQL pane for a tablespace:
> Note the three blank lines, where I would expect:

Thanks - all fixed.

Regards, Dave

Re: Comments on roles and tablespaces for pg 8.2+

From
"Hiroshi Saito"
Date:
Hi.

> Erwin Brandstetter wrote:
>> In beta 3 the comments on role and tablespace seem to work fine!
>> However, the new controls also show up for older versions < 8.2 (tested
>> with 8.1.8), resulting in errors when used.
>>
>> Another (maybe unrelated?) peculiarity (pg 8.1 and 8.2), this is what I
>> get in the SQL pane for a tablespace:
>> Note the three blank lines, where I would expect:
>
> Thanks - all fixed.

Great thanks!!

I returned from vacation.:-)
I'm arranging a lot of mail now....

Regards,
Hiroshi Saito