aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2009-07-07 20:32:20 +0000
committerPeter Eisentraut <peter_e@gmx.net>2009-07-07 20:32:20 +0000
commitb34f6ab80474da3c64b4d70f0e57e544275b67df (patch)
tree6daa24c90678210f5265c0980eae33d780a813c7
parentba3fb57d8171e7d0d0e27942f6ce8ae364c8d87a (diff)
downloadpostgresql-b34f6ab80474da3c64b4d70f0e57e544275b67df.tar.gz
postgresql-b34f6ab80474da3c64b4d70f0e57e544275b67df.zip
psql backward compatibility fix
For servers older than 8.3, sort display of child tables by relname instead of oid::regclass::text, because the cast from regclass to text did not work back then. The older display may be slightly worse when different schemas are involved, but that should be rare enough.
-rw-r--r--src/bin/psql/describe.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 80b4bd5e9d7..da089049018 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -8,7 +8,7 @@
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.222 2009/07/07 19:05:57 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.223 2009/07/07 20:32:20 petere Exp $
*/
#include "postgres_fe.h"
@@ -1821,7 +1821,10 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print child tables */
- printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.oid::pg_catalog.regclass::text;", oid);
+ if (pset.sversion >= 80300)
+ printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.oid::pg_catalog.regclass::text;", oid);
+ else
+ printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.relname;", oid);
result = PSQLexec(buf.data, false);
if (!result)