Skip to content

Commit 9c5dacc

Browse files
committed
Column ordering in \d output should agree with sort ordering;
per Joe Conway's patch of 20-July.
1 parent 4ab8e69 commit 9c5dacc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bin/psql/describe.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.57 2002/08/02 18:15:08 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.58 2002/08/09 18:06:57 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -1021,11 +1021,11 @@ listTables(const char *infotype, const char *name, bool desc)
10211021
initPQExpBuffer(&buf);
10221022

10231023
printfPQExpBuffer(&buf,
1024-
"SELECT c.relname as \"%s\",\n"
1025-
" n.nspname as \"%s\",\n"
1024+
"SELECT n.nspname as \"%s\",\n"
1025+
" c.relname as \"%s\",\n"
10261026
" CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as \"%s\",\n"
10271027
" u.usename as \"%s\"",
1028-
_("Name"), _("Schema"), _("table"), _("view"), _("index"), _("sequence"),
1028+
_("Schema"), _("Name"), _("table"), _("view"), _("index"), _("sequence"),
10291029
_("special"), _("Type"), _("Owner"));
10301030

10311031
if (desc)
@@ -1068,7 +1068,7 @@ listTables(const char *infotype, const char *name, bool desc)
10681068
if (name)
10691069
appendPQExpBuffer(&buf, " AND c.relname ~ '^%s'\n", name);
10701070

1071-
appendPQExpBuffer(&buf, "ORDER BY 2,1;");
1071+
appendPQExpBuffer(&buf, "ORDER BY 1,2;");
10721072

10731073
res = PSQLexec(buf.data);
10741074
termPQExpBuffer(&buf);

0 commit comments

Comments
 (0)