Error in ORDER BY on check constraints in psql - Mailing list pgsql-patches

From Christopher Kings-Lynne
Subject Error in ORDER BY on check constraints in psql
Date
Msg-id 435725A1.5070900@familyhealth.com.au
Whole thread Raw
Responses Re: Error in ORDER BY on check constraints in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Everything is sorted by object name in \d <table> except check
constraints for some reason.  It seems it's ordering by the wrong column.

Seems like a bug to me.

Attached is the trivial patch.

Chris
Index: src/bin/psql/describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.127
diff -c -r1.127 describe.c
*** src/bin/psql/describe.c    15 Oct 2005 02:49:40 -0000    1.127
--- src/bin/psql/describe.c    20 Oct 2005 04:58:58 -0000
***************
*** 1040,1046 ****
                                "pg_catalog.pg_get_constraintdef(r.oid, true), "
                                "conname\n"
                                "FROM pg_catalog.pg_constraint r\n"
!                     "WHERE r.conrelid = '%s' AND r.contype = 'c' ORDER BY 1",
                                oid);
              result2 = PSQLexec(buf.data, false);
              if (!result2)
--- 1040,1046 ----
                                "pg_catalog.pg_get_constraintdef(r.oid, true), "
                                "conname\n"
                                "FROM pg_catalog.pg_constraint r\n"
!                     "WHERE r.conrelid = '%s' AND r.contype = 'c' ORDER BY 2",
                                oid);
              result2 = PSQLexec(buf.data, false);
              if (!result2)

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Small plperl documentation patch
Next
From: Tom Lane
Date:
Subject: Re: Error in ORDER BY on check constraints in psql