Commit ae7ea139 authored by Neil Conway's avatar Neil Conway

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.
parent 35e88b51
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2004, PostgreSQL Global Development Group * Copyright (c) 2000-2004, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.106 2004/08/29 05:06:54 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.107 2004/09/10 04:10:53 neilc Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "describe.h" #include "describe.h"
...@@ -169,12 +169,12 @@ describeFunctions(const char *pattern, bool verbose) ...@@ -169,12 +169,12 @@ describeFunctions(const char *pattern, bool verbose)
initPQExpBuffer(&buf); initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||\n" "SELECT n.nspname as \"%s\",\n"
" pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
" n.nspname as \"%s\",\n"
" p.proname 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\"", " pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
_("Result data type"), _("Schema"), _("Name"), _("Schema"), _("Name"), _("Result data type"),
_("Argument data types")); _("Argument data types"));
if (verbose) if (verbose)
...@@ -210,7 +210,7 @@ describeFunctions(const char *pattern, bool verbose) ...@@ -210,7 +210,7 @@ describeFunctions(const char *pattern, bool verbose)
"n.nspname", "p.proname", NULL, "n.nspname", "p.proname", NULL,
"pg_catalog.pg_function_is_visible(p.oid)"); "pg_catalog.pg_function_is_visible(p.oid)");
appendPQExpBuffer(&buf, "ORDER BY 2, 3, 1, 4;"); appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3, 4;");
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data, false);
termPQExpBuffer(&buf); termPQExpBuffer(&buf);
...@@ -1477,6 +1477,11 @@ listTables(const char *tabtypes, const char *pattern, bool verbose) ...@@ -1477,6 +1477,11 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
_("table"), _("view"), _("index"), _("sequence"), _("table"), _("view"), _("index"), _("sequence"),
_("special"), _("Type"), _("Owner")); _("special"), _("Type"), _("Owner"));
if (showIndexes)
appendPQExpBuffer(&buf,
",\n c2.relname as \"%s\"",
_("Table"));
if (verbose) if (verbose)
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"", ",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
...@@ -1484,13 +1489,11 @@ listTables(const char *tabtypes, const char *pattern, bool verbose) ...@@ -1484,13 +1489,11 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
if (showIndexes) if (showIndexes)
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
",\n c2.relname as \"%s\""
"\nFROM pg_catalog.pg_class c" "\nFROM pg_catalog.pg_class c"
"\n JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid" "\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 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_user u ON u.usesysid = c.relowner"
"\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
_("Table"));
else else
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
"\nFROM pg_catalog.pg_class c" "\nFROM pg_catalog.pg_class c"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2004, PostgreSQL Global Development Group * Copyright (c) 2000-2004, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.33 2004/08/29 04:13:02 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.34 2004/09/10 04:10:53 neilc Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "large_obj.h" #include "large_obj.h"
...@@ -249,9 +249,10 @@ do_lo_list(void) ...@@ -249,9 +249,10 @@ do_lo_list(void)
printQueryOpt myopt = pset.popt; printQueryOpt myopt = pset.popt;
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"SELECT loid as \"ID\", pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n" "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" "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
"ORDER BY \"ID\"", "ORDER BY 1",
gettext("Description")); gettext("Description"));
res = PSQLexec(buf, false); res = PSQLexec(buf, false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment