Skip site navigation (1) Skip section navigation (2)

BUG #4547: sort columns in \d

From: "Ferdinand Gassauer" <gassauer(at)kde(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4547: sort columns in \d
Date: 2008-11-23 16:19:38
Message-ID: 200811231619.mANGJciW041976@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      4547
Logged by:          Ferdinand Gassauer
Email address:      gassauer(at)kde(dot)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)

Responses

pgsql-bugs by date

Next:From: toruvinnDate: 2008-11-23 16:36:13
Subject: Re: BUG #4547: sort columns in \d
Previous:From: Gregory StarkDate: 2008-11-22 22:56:15
Subject: Re: could not read block 77 of relation 1663/16385/388818775

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group