Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ae7ea13

Browse files
author
Neil Conway
committed
psql consistency fixes from Greg Sabino Mullane: have \df show schema and
name first, make sure \di+ shows description last, and make \dl SQL look a little more standard.
1 parent 35e88b5 commit ae7ea13

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/bin/psql/describe.c

+13-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.106 2004/08/29 05:06:54 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.107 2004/09/10 04:10:53 neilc Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -169,12 +169,12 @@ describeFunctions(const char *pattern, bool verbose)
169169
initPQExpBuffer(&buf);
170170

171171
printfPQExpBuffer(&buf,
172-
"SELECT CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n"
173-
" pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
174-
" n.nspname as \"%s\",\n"
172+
"SELECT n.nspname as \"%s\",\n"
175173
" p.proname as \"%s\",\n"
176-
" pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
177-
_("Result data type"), _("Schema"), _("Name"),
174+
" CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n"
175+
" pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
176+
" pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
177+
_("Schema"), _("Name"), _("Result data type"),
178178
_("Argument data types"));
179179

180180
if (verbose)
@@ -210,7 +210,7 @@ describeFunctions(const char *pattern, bool verbose)
210210
"n.nspname", "p.proname", NULL,
211211
"pg_catalog.pg_function_is_visible(p.oid)");
212212

213-
appendPQExpBuffer(&buf, "ORDER BY 2, 3, 1, 4;");
213+
appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3, 4;");
214214

215215
res = PSQLexec(buf.data, false);
216216
termPQExpBuffer(&buf);
@@ -1477,20 +1477,23 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
14771477
_("table"), _("view"), _("index"), _("sequence"),
14781478
_("special"), _("Type"), _("Owner"));
14791479

1480+
if (showIndexes)
1481+
appendPQExpBuffer(&buf,
1482+
",\n c2.relname as \"%s\"",
1483+
_("Table"));
1484+
14801485
if (verbose)
14811486
appendPQExpBuffer(&buf,
14821487
",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
14831488
_("Description"));
14841489

14851490
if (showIndexes)
14861491
appendPQExpBuffer(&buf,
1487-
",\n c2.relname as \"%s\""
14881492
"\nFROM pg_catalog.pg_class c"
14891493
"\n JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
14901494
"\n JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
14911495
"\n LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
1492-
"\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
1493-
_("Table"));
1496+
"\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
14941497
else
14951498
appendPQExpBuffer(&buf,
14961499
"\nFROM pg_catalog.pg_class c"

src/bin/psql/large_obj.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.33 2004/08/29 04:13:02 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.34 2004/09/10 04:10:53 neilc Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "large_obj.h"
@@ -249,9 +249,10 @@ do_lo_list(void)
249249
printQueryOpt myopt = pset.popt;
250250

251251
snprintf(buf, sizeof(buf),
252-
"SELECT loid as \"ID\", pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n"
253-
"FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
254-
"ORDER BY \"ID\"",
252+
"SELECT loid as \"ID\",\n"
253+
" pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n"
254+
"FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
255+
"ORDER BY 1",
255256
gettext("Description"));
256257

257258
res = PSQLexec(buf, false);

0 commit comments

Comments
 (0)