2012/3/14 Tom Lane <t...@sss.pgh.pa.us>

>
> Why would you confine it to verbose mode?


Because I did not want to change the current behavior of this psql
command... but...


For most people it won't
> matter, but for people who are using the feature, it seems like
> important information.  Per the OP's complaint, it's particularly
> important for those who have forgotten they're using the feature
> (and hence would not think to specify "+" ...)
>
>
You' re right, then I attached a new patch with your suggestion.

Regards,

-- 
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
***************
*** 2382,2388 **** describeRoles(const char *pattern, bool verbose)
  						  "  ARRAY(SELECT b.rolname\n"
  						  "        FROM pg_catalog.pg_auth_members m\n"
  				 "        JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n"
! 						  "        WHERE m.member = r.oid) as memberof");
  
  		if (verbose && pset.sversion >= 80200)
  		{
--- 2382,2389 ----
  						  "  ARRAY(SELECT b.rolname\n"
  						  "        FROM pg_catalog.pg_auth_members m\n"
  				 "        JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n"
! 						  "        WHERE m.member = r.oid) as memberof,\n"
! 						  "  'Valid until '::text||r.rolvaliduntil::text as rolvaliduntil");
  
  		if (verbose && pset.sversion >= 80200)
  		{
***************
*** 2407,2413 **** describeRoles(const char *pattern, bool verbose)
  						  "  true AS rolinherit, false AS rolcreaterole,\n"
  					 "  u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n"
  						  "  -1 AS rolconnlimit,\n"
! 						  "  ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof"
  						  "\nFROM pg_catalog.pg_user u\n");
  
  		processSQLNamePattern(pset.db, &buf, pattern, false, false,
--- 2408,2415 ----
  						  "  true AS rolinherit, false AS rolcreaterole,\n"
  					 "  u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n"
  						  "  -1 AS rolconnlimit,\n"
! 						  "  ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof,\n"
! 						  "  'Valid until '::text||u.valuntil::text as rolvaliduntil"
  						  "\nFROM pg_catalog.pg_user u\n");
  
  		processSQLNamePattern(pset.db, &buf, pattern, false, false,
***************
*** 2452,2459 **** describeRoles(const char *pattern, bool verbose)
  		if (strcmp(PQgetvalue(res, i, 5), "t") != 0)
  			add_role_attribute(&buf, _("Cannot login"));
  
  		if (pset.sversion >= 90100)
! 			if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
  				add_role_attribute(&buf, _("Replication"));
  
  		conns = atoi(PQgetvalue(res, i, 6));
--- 2454,2464 ----
  		if (strcmp(PQgetvalue(res, i, 5), "t") != 0)
  			add_role_attribute(&buf, _("Cannot login"));
  
+ 		if (strcmp(PQgetvalue(res, i, 8), "") != 0 && verbose)
+       add_role_attribute(&buf, PQgetvalue(res, i, 8));
+ 
  		if (pset.sversion >= 90100)
! 			if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
  				add_role_attribute(&buf, _("Replication"));
  
  		conns = atoi(PQgetvalue(res, i, 6));
***************
*** 2478,2485 **** describeRoles(const char *pattern, bool verbose)
  		printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
  
  		if (verbose && pset.sversion >= 80200)
! 			printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);
! 	}
  	termPQExpBuffer(&buf);
  
  	printTable(&cont, pset.queryFout, pset.logfile);
--- 2483,2491 ----
  		printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
  
  		if (verbose && pset.sversion >= 80200)
! 			printTableAddCell(&cont, PQgetvalue(res, i, 9), false, false);
! 	
!   }
  	termPQExpBuffer(&buf);
  
  	printTable(&cont, pset.queryFout, pset.logfile);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to