Re: [HACKERS] psql - small fix in \du

2009-07-23 Thread Andreas Wenk

Tom Lane schrieb:

Andreas Wenk a.w...@netzmeister-st-pauli.de writes:
I am not sure when the function shobj_description(oid, name) is giving a 
result.


That retrieves the comment for the object (the role, in this case).

regards, tom lane



attached you can find an updated patch. The changes are:

- change \du and \dg to \du+ and \dg+ in the docu
- change the same in psql/help.c
- change the translation files in psql/po

two questions on this:

- is it ok to provide all these changes in one patch?
- I did the patch with git format-patch and left the header in the patch. Ok?

Although Tom asked if the translation files should be patched at all, I sent 
them.

vi showed the foreign language signs in the patch utf-8 encoded and not as the character. 
I imported the patch in my local master. The md5checksum was the same (e.g ja.po) an the 
character are in original language. Everything was ok - so if there are problems, please 
keep me informed.


Cheers

Andy
From 6a54ecafa1626631c6de78f59f72825ab554b9a3 Mon Sep 17 00:00:00 2001
From: Andreas Wenk a.w...@netzmeister-st-pauli.de
Date: Thu, 23 Jul 2009 11:15:05 +0200
Subject: [PATCH] In psql \du and \dg can also be used as \du+ and \dg+. This
 was missing in psql help. All affected files have been changed.

---
 doc/src/sgml/ref/psql-ref.sgml |   10 +++---
 src/bin/psql/help.c|4 ++--
 src/bin/psql/po/cs.po  |8 
 src/bin/psql/po/de.po  |8 
 src/bin/psql/po/es.po  |8 
 src/bin/psql/po/fr.po  |8 
 src/bin/psql/po/ja.po  |8 
 src/bin/psql/po/pt_BR.po   |8 
 src/bin/psql/po/sv.po  |8 
 src/bin/psql/po/tr.po  |8 
 10 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index cd94af1..6de4b83 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1124,13 +1124,15 @@ testdb=gt;
 
 
   varlistentry
-termliteral\dg [ replaceable class=parameterpattern/replaceable ]/literal/term
+termliteral\dg[+] [ replaceable class=parameterpattern/replaceable ]/literal/term
 listitem
 para
 Lists all database roles. If replaceable
 class=parameterpattern/replaceable is specified, only
 those roles whose names match the pattern are listed.
-(This command is now effectively the same as literal\du/.)
+(This command is now effectively the same as literal\du/literal).
+	If the form literal\dg+/literal is used, additional information 
+	is shown about each role, including the comment for each role.  
 /para
 /listitem
   /varlistentry
@@ -1247,12 +1249,14 @@ testdb=gt;
 
 
   varlistentry
-termliteral\du [ replaceable class=parameterpattern/replaceable ]/literal/term
+termliteral\du[+] [ replaceable class=parameterpattern/replaceable ]/literal/term
 listitem
 para
 Lists all database roles. If replaceable
 class=parameterpattern/replaceable is specified, only
 those roles whose names match the pattern are listed.
+	If the form literal\du+/literal is used, additional information
+	is shown about each role, including the comment for each role.
 /para
 /listitem
   /varlistentry
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5f13b8a..74c379f 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -210,7 +210,7 @@ slashUsage(unsigned short int pager)
 	fprintf(output, _(  \\dFd[+] [PATTERN]  list text search dictionaries\n));
 	fprintf(output, _(  \\dFp[+] [PATTERN]  list text search parsers\n));
 	fprintf(output, _(  \\dFt[+] [PATTERN]  list text search templates\n));
-	fprintf(output, _(  \\dg [PATTERN]  list roles (groups)\n));
+	fprintf(output, _(  \\dg[+]  [PATTERN]  list roles (groups)\n));
 	fprintf(output, _(  \\di[S+] [PATTERN]  list indexes\n));
 	fprintf(output, _(  \\dllist large objects, same as \\lo_list\n));
 	fprintf(output, _(  \\dn[+]  [PATTERN]  list schemas\n));
@@ -219,7 +219,7 @@ slashUsage(unsigned short int pager)
 	fprintf(output, _(  \\ds[S+] [PATTERN]  list sequences\n));
 	fprintf(output, _(  \\dt[S+] [PATTERN]  list tables\n));
 	fprintf(output, _(  \\dT[S+] [PATTERN]  list data types\n));
-	fprintf(output, _(  \\du [PATTERN]  list roles (users)\n));
+	fprintf(output, _(  \\du[+]  [PATTERN]  list roles (users)\n));
 	fprintf(output, _(  \\dv[S+] [PATTERN]  list views\n));
 	fprintf(output, _(  \\l[+]  list all databases\n));
 	fprintf(output, _(  \\z  [PATTERN]  same as \\dp\n));
diff --git a/src/bin/psql/po/cs.po b/src/bin/psql/po/cs.po
index 196bfe3..eed7ada 100644
--- a/src/bin/psql/po/cs.po
+++ b/src/bin/psql/po/cs.po
@@ -965,8 +965,8 @@ msgstr   \\dFt[+] [VZOR

Re: [HACKERS] psql - small fix in \du

2009-07-22 Thread Andreas Wenk

ANdreas Wenk schrieb:

Hi,

attached you can find a very small patch for the help in psql (\?). It's 
possible to use \du also as \du+ . The [+] was missing in help.


I was asking about this at the general list and Peter E. was asking me 
to provide a patch. I sent the patch there but realized now, that this 
was the wrong place to do so. Sorry for the flood ...


Cheers

Andy



As written in another post \dg misses also the [+] so I changed that. Now I recognized 
that I also have to change psql-ref.sgml (sorry did not see it in help.c). So I wanted to 
update it and I am now wondering, what will be written in the description row when using 
\du+ or \dg+. I am not sure when the function shobj_description(oid, name) is giving a 
result.


Can anybody give me a hint or a scenario so that I can update the patch 
correctly?

Thanks a lot

Andy

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] psql - small fix in \du

2009-07-22 Thread Andreas Wenk

Tom Lane wrote:

Andreas Wenk a.w...@netzmeister-st-pauli.de writes:
I am not sure when the function shobj_description(oid, name) is giving a 
result.


That retrieves the comment for the object (the role, in this case).

regards, tom lane


Tom, thank you. I will provide an updated patch tomorrow.

Cheers

Andy

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] psql \du and \dg is the same - pg 8.4

2009-07-21 Thread ANdreas Wenk

Hi,

actually I discovered that using \du and \dg in psql is providing the 
same result:


book=# \du
* QUERY **
SELECT r.rolname, r.rolsuper, r.rolinherit,
  r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,
  r.rolconnlimit,
  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 memberof
FROM pg_catalog.pg_roles r
ORDER BY 1;
**

  List of roles
   Role name   |  Attributes  | Member of
---+--+---
 postgres  | Superuser| {}
   : Create role
   : Create DB
 ps_buch_group |  | {}
 psbuch|  | {}
 psbuch_role   | Cannot login | {}
 roundcube |  | {}

book=# \dg
* QUERY **
SELECT r.rolname, r.rolsuper, r.rolinherit,
  r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,
  r.rolconnlimit,
  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 memberof
FROM pg_catalog.pg_roles r
ORDER BY 1;
**

  List of roles
   Role name   |  Attributes  | Member of
---+--+---
 postgres  | Superuser| {}
   : Create role
   : Create DB
 ps_buch_group |  | {}
 psbuch|  | {}
 psbuch_role   | Cannot login | {}
 roundcube |  | {}

Commonly a grouprole is defined as a role with no right to login. As of 
this, the following statement should list all grouproles:


SELECT r.rolname, r.rolsuper, r.rolinherit,
  r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,
  r.rolconnlimit,
  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 memberof
FROM pg_catalog.pg_roles r
WHERE r.rolcanlogin = 'f'
ORDER BY 1;

rolname|rolsuper|rolinherit|rolcreaterole|rolcreatedb|rolcanlogin| 
rolconnlimit|memberof

---++--+-+---+---+
---+-
psbuch_role| f  | t| f   | f | f | 
 -1 | {}

(1 row)

On the other hand a group role can also have the login privilege as of 
all roles can have members or not with the privilege login or not.


I am wondering why there is \dg at all. I am not sure what the intention 
is to have it. And also I am not sure if the definition of a group role 
(having no login privilege) is really correct.


Any ideas on this? If there is a clear solution and the implementation 
of \dg is wanted but not correctly implemented, I could try to provide a 
patch.


By the way. It's also possible to use \dg+ . This is missing in the psql 
help (\dg[+]) in the same way as for \du (see my small patch).


If I missed something please lend me a hand to the right way.

Cheers

Andy


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] psql \du and \dg is the same - pg 8.4

2009-07-21 Thread Andreas Wenk

Tom Lane wrote:

ANdreas Wenk a.w...@netzmeister-st-pauli.de writes:
actually I discovered that using \du and \dg in psql is providing the 
same result:


Yup.  The psql documentation says as much.


ok - got it ;-)

Should have read the psql docu ...


I am wondering why there is \dg at all.


Users and groups used to be distinct kinds of objects.  They aren't
anymore, but people might still be used to the old commands.


Yeah I know - but I was wondering if it would make sense to have \dg 
with a different result because here


http://www.postgresql.org/docs/8.4/interactive/role-membership.html

the people still read about group roles. I am not sure what is confusing 
here - in psql or in the docu.



regards, tom lane


Cheers

Andy
Cheers

Andy

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] psql - small fix in \du

2009-07-17 Thread ANdreas Wenk

Hi,

attached you can find a very small patch for the help in psql (\?). It's 
possible to use \du also as \du+ . The [+] was missing in help.


I was asking about this at the general list and Peter E. was asking me 
to provide a patch. I sent the patch there but realized now, that this 
was the wrong place to do so. Sorry for the flood ...


Cheers

Andy
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5f13b8a..8a541e6 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -219,7 +219,7 @@ slashUsage(unsigned short int pager)
fprintf(output, _(  \\ds[S+] [PATTERN]  list sequences\n));
fprintf(output, _(  \\dt[S+] [PATTERN]  list tables\n));
fprintf(output, _(  \\dT[S+] [PATTERN]  list data types\n));
-   fprintf(output, _(  \\du [PATTERN]  list roles (users)\n));
+   fprintf(output, _(  \\du[+]  [PATTERN]  list roles (users)\n));
fprintf(output, _(  \\dv[S+] [PATTERN]  list views\n));
fprintf(output, _(  \\l[+]  list all databases\n));
fprintf(output, _(  \\z  [PATTERN]  same as \\dp\n)); 

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers