summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2009-07-07 20:32:20 +0000
committerPeter Eisentraut2009-07-07 20:32:20 +0000
commite7ab180792afdce963be3eb722ae87a5a020ddd0 (patch)
tree1074f9671bda053fc1191c0fc818fbe941e6cc5b
parent8d5970de84675bb8ff002dc1de0135b6547b3ed2 (diff)
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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 2671afde55..e89b99d6c1 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -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)