BUG #4547: sort columns in \d - Mailing list pgsql-bugs

From Ferdinand Gassauer
Subject BUG #4547: sort columns in \d
Date
Msg-id 200811231619.mANGJciW041976@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4547: sort columns in \d  (toruvinn <toruvinn@lain.pl>)
Re: BUG #4547: sort columns in \d  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4547
Logged by:          Ferdinand Gassauer
Email address:      gassauer@kde.org
PostgreSQL version: 8.3.5
Operating system:   any
Description:        sort columns in \d
Details:

currently the columns are sorted by attnum (not very userfriendly) instead
of attname (userfriendly)

this patch fixes this and makes the output of \d much more usable.

thank you for listening


--- describe.c.dist     2008-11-23 16:59:07.000000000 +0100
+++ describe.c  2008-11-23 16:59:28.000000000 +0100
@@ -867,7 +867,7 @@ describeOneTableDetails(const char *sche
        appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0
AND NOT a.attisdropped", oid);
        if (tableinfo.relkind == 'i')
                appendPQExpBuffer(&buf, " AND a.attrelid = i.indexrelid");
-       appendPQExpBuffer(&buf, "\nORDER BY a.attnum");
+       appendPQExpBuffer(&buf, "\nORDER BY a.attname");

        res = PSQLexec(buf.data, false);
        if (!res)

pgsql-bugs by date:

Previous
From: Gregory Stark
Date:
Subject: Re: could not read block 77 of relation 1663/16385/388818775
Next
From: toruvinn
Date:
Subject: Re: BUG #4547: sort columns in \d