diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-20 05:15:09 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-10-20 05:15:09 +0000 |
commit | a5bd1d357a417679421bd2deb031a644b489bdfe (patch) | |
tree | bc9773b35941fdc373d7a2f93164b5e7b9d064c9 /src | |
parent | d9cb48786ee84c27dc20e3aed92bb1f1cadf95c3 (diff) | |
download | postgresql-a5bd1d357a417679421bd2deb031a644b489bdfe.tar.gz postgresql-a5bd1d357a417679421bd2deb031a644b489bdfe.zip |
Make \d order a table's check constraints by constraint name instead
of the text of the constraint condition. Per Chris K-L, though I didn't
use his patch exactly.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/describe.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index d146b441f77..889014ffeae 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.127 2005/10/15 02:49:40 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.128 2005/10/20 05:15:09 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -1036,9 +1036,8 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.checks) { printfPQExpBuffer(&buf, - "SELECT " - "pg_catalog.pg_get_constraintdef(r.oid, true), " - "conname\n" + "SELECT r.conname, " + "pg_catalog.pg_get_constraintdef(r.oid, true)\n" "FROM pg_catalog.pg_constraint r\n" "WHERE r.conrelid = '%s' AND r.contype = 'c' ORDER BY 1", oid); @@ -1192,8 +1191,8 @@ describeOneTableDetails(const char *schemaname, for (i = 0; i < check_count; i++) { printfPQExpBuffer(&buf, _(" \"%s\" %s"), - PQgetvalue(result2, i, 1), - PQgetvalue(result2, i, 0)); + PQgetvalue(result2, i, 0), + PQgetvalue(result2, i, 1)); footers[count_footers++] = pg_strdup(buf.data); } |