On Thu, 30 Mar 2006 01:13 pm, Tom Lane wrote:
> Philip Yarra <[EMAIL PROTECTED]> writes:
> > Please let me know if this patch needs any changes for acceptance. I
> > would prefer the tablespace row to the left of Description,
>
> Me too --- that looks pretty weird as-is.

OK, revised patch attached. Less-weird output now looks like this:

                           List of databases
   Name    | Owner  | Encoding | Tablespace |        Description
-----------+--------+----------+------------+---------------------------
 postgres  | pyarra | LATIN1   | pg_default |
 pyarra    | pyarra | LATIN1   | pg_default |
 spctest   | pyarra | LATIN1   | spctable   |
 template0 | pyarra | LATIN1   | pg_default |
 template1 | pyarra | LATIN1   | pg_default | Default template database
(5 rows)

Much nicer, I think.

Regards, Philip.

-- 

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

-----------------
Utiba Pty Ltd 
This message has been scanned for viruses and
dangerous content by Utiba mail server and is 
believed to be clean.

Index: src/bin/psql/describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.133
diff -c -r1.133 describe.c
*** src/bin/psql/describe.c	5 Mar 2006 15:58:51 -0000	1.133
--- src/bin/psql/describe.c	30 Mar 2006 03:28:34 -0000
***************
*** 362,375 ****
  			",\n       pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
  					  _("Encoding"));
  	if (verbose)
  		appendPQExpBuffer(&buf,
  						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
  						  _("Description"));
  	appendPQExpBuffer(&buf,
  					  "\nFROM pg_catalog.pg_database d"
! 				  "\n  JOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n"
! 					  "ORDER BY 1;");
! 
  	res = PSQLexec(buf.data, false);
  	termPQExpBuffer(&buf);
  	if (!res)
--- 362,382 ----
  			",\n       pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
  					  _("Encoding"));
  	if (verbose)
+ 	{
+ 		appendPQExpBuffer(&buf,
+ 						  ",\n       t.spcname as \"%s\"",
+ 						  _("Tablespace"));
  		appendPQExpBuffer(&buf,
  						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
  						  _("Description"));
+ 	}
  	appendPQExpBuffer(&buf,
  					  "\nFROM pg_catalog.pg_database d"
! 				  "\n  JOIN pg_catalog.pg_roles r ON d.datdba = r.oid\n");
! 	if (verbose)
! 		appendPQExpBuffer(&buf,
! 					"  JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n");	
! 	appendPQExpBuffer(&buf,"ORDER BY 1;");
  	res = PSQLexec(buf.data, false);
  	termPQExpBuffer(&buf);
  	if (!res)
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to