Re: [HACKERS] psql: \dg off by one error

2011-02-27 Thread Magnus Hagander
On Sun, Feb 27, 2011 at 01:21, Josh Kupershmidt schmi...@gmail.com wrote:
 Hi all,

 I noticed an off by one error in psql's verbose-mode display for \dg
 and \du. In verbose mode, \dg and \du will not display the
 Replication attribute:

 test=# \dg rep
            List of roles
  Role name | Attributes  | Member of
 ---+-+---
  rep       | Replication | {}

 test=# \dg+ rep
                  List of roles
  Role name | Attributes | Member of | Description
 ---++---+-
  rep       |            | {}        |


 Attached is a one line patch to fix.

Applied, thanks.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
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: \dg off by one error

2011-02-26 Thread Josh Kupershmidt
Hi all,

I noticed an off by one error in psql's verbose-mode display for \dg
and \du. In verbose mode, \dg and \du will not display the
Replication attribute:

test=# \dg rep
List of roles
 Role name | Attributes  | Member of
---+-+---
 rep   | Replication | {}

test=# \dg+ rep
  List of roles
 Role name | Attributes | Member of | Description
---++---+-
 rep   || {}|


Attached is a one line patch to fix.

Josh
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 9dc02a1..fc860cc 100644
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
*** describeRoles(const char *pattern, bool
*** 2342,2348 
  			add_role_attribute(buf, _(Cannot login));
  
  		if (pset.sversion = 90100)
! 			if (strcmp(PQgetvalue(res, i, 8), t) == 0)
  add_role_attribute(buf, _(Replication));
  
  		conns = atoi(PQgetvalue(res, i, 6));
--- 2342,2348 
  			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));

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