Minor psql consistency fixes

Поиск
Список
Период
Сортировка
Искать

Minor psql consistency fixes

От:
"Greg Sabino Mullane" <greg@turnstep.com>
Дата:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


Minor consistency fixes: have \df show schema and name first, 
make sure \di+ shows description last, and make \dl SQL look 
a little more standard.

Index: describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/describe.c,v
retrieving revision 1.106
diff -c -r1.106 describe.c
*** describe.c	29 Aug 2004 05:06:54 -0000	1.106
--- describe.c	5 Sep 2004 16:05:42 -0000
***************
*** 169,181 ****
  	initPQExpBuffer(&buf);
  
  	printfPQExpBuffer(&buf,
! 			"SELECT CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n"
! 			  "  pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
! 					  "  n.nspname as \"%s\",\n"
! 					  "  p.proname as \"%s\",\n"
! 				  "  pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
! 					  _("Result data type"), _("Schema"), _("Name"),
! 					  _("Argument data types"));
  
  	if (verbose)
  		appendPQExpBuffer(&buf,
--- 169,181 ----
  	initPQExpBuffer(&buf);
  
  	printfPQExpBuffer(&buf,
! 										"SELECT n.nspname as \"%s\",\n"
! 										"  p.proname as \"%s\",\n"
! 										"  CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n"
! 										"  pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
! 										"  pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
! 										_("Schema"), _("Name"), _("Result data type"), 
! 										_("Argument data types"));
  
  	if (verbose)
  		appendPQExpBuffer(&buf,
***************
*** 210,216 ****
  					   "n.nspname", "p.proname", NULL,
  					   "pg_catalog.pg_function_is_visible(p.oid)");
  
! 	appendPQExpBuffer(&buf, "ORDER BY 2, 3, 1, 4;");
  
  	res = PSQLexec(buf.data, false);
  	termPQExpBuffer(&buf);
--- 210,216 ----
  					   "n.nspname", "p.proname", NULL,
  					   "pg_catalog.pg_function_is_visible(p.oid)");
  
! 	appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3, 4;");
  
  	res = PSQLexec(buf.data, false);
  	termPQExpBuffer(&buf);
***************
*** 1477,1482 ****
--- 1477,1487 ----
  					  _("table"), _("view"), _("index"), _("sequence"),
  					  _("special"), _("Type"), _("Owner"));
  
+ 	if (showIndexes)
+ 		appendPQExpBuffer(&buf,
+ 						  ",\n c2.relname as \"%s\"",
+ 							  _("Table"));
+ 
  	if (verbose)
  		appendPQExpBuffer(&buf,
  		  ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
***************
*** 1484,1496 ****
  
  	if (showIndexes)
  		appendPQExpBuffer(&buf,
- 						  ",\n c2.relname as \"%s\""
  						  "\nFROM pg_catalog.pg_class c"
  			  "\n     JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
  			  "\n     JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
  		"\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
! 						  "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
! 						  _("Table"));
  	else
  		appendPQExpBuffer(&buf,
  						  "\nFROM pg_catalog.pg_class c"
--- 1489,1499 ----
  
  	if (showIndexes)
  		appendPQExpBuffer(&buf,
  						  "\nFROM pg_catalog.pg_class c"
  			  "\n     JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
  			  "\n     JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
  		"\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
! 						  "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
  	else
  		appendPQExpBuffer(&buf,
  						  "\nFROM pg_catalog.pg_class c"
Index: large_obj.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/large_obj.c,v
retrieving revision 1.33
diff -c -r1.33 large_obj.c
*** large_obj.c	29 Aug 2004 04:13:02 -0000	1.33
--- large_obj.c	5 Sep 2004 16:05:43 -0000
***************
*** 249,257 ****
  	printQueryOpt myopt = pset.popt;
  
  	snprintf(buf, sizeof(buf),
! 			 "SELECT loid as \"ID\", pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n"
! 		 "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
! 			 "ORDER BY \"ID\"",
  			 gettext("Description"));
  
  	res = PSQLexec(buf, false);
--- 249,258 ----
  	printQueryOpt myopt = pset.popt;
  
  	snprintf(buf, sizeof(buf),
! 					 "SELECT loid as \"ID\",\n"
! 					 "  pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n"
! 					 "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
! 					 "ORDER BY 1",
  			 gettext("Description"));
  
  	res = PSQLexec(buf, false);




--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200409051208

-----BEGIN PGP SIGNATURE-----

iD8DBQFBOzqCvJuQZxSWSsgRAgG7AJ9v7cwxp+3dlHRR4Ct14yhHWxfAhACfaK20
WyCK45Ju0daOMIdToxpZ0xU=
=c776
-----END PGP SIGNATURE-----


Re: Minor psql consistency fixes

От:
Neil Conway <neilc@samurai.com>
Дата:
Greg Sabino Mullane wrote:
> Minor consistency fixes: have \df show schema and name first, 
> make sure \di+ shows description last, and make \dl SQL look 
> a little more standard.

I'll apply this in the next 24 hours, barring any objections.

-Neil

Re: Minor psql consistency fixes

От:
Neil Conway <neilc@samurai.com>
Дата:
Greg Sabino Mullane wrote:
> Minor consistency fixes: have \df show schema and name first, 
> make sure \di+ shows description last, and make \dl SQL look 
> a little more standard.

Patch applied -- thanks!

-Neil
FAQ