ITAGAKI Takahiro wrote: > 2. psql's \d+ doesn't show toast storage parameters. > > Neither \d+ for base tables nor toast relations show toast.* parameters > though there are some values in pg_class.reloptions. > I think we should show toast.* parameters in \d+ for base tables > because it has consistency; we set them at ALTER TABLE for base tables.
This patch seems to fix this problem. Note that it introduces a LEFT JOIN on pg_class to itself that's always present, even for server versions that do not support reloptions. I'm not sure that this is a problem; I can't measure any difference on \d with and without the patch on a test database with 1000 tables.
Index: src/bin/psql/describe.c =================================================================== RCS file: /home/alvherre/cvs/pgsql/src/bin/psql/describe.c,v retrieving revision 1.198 diff -c -p -r1.198 describe.c *** src/bin/psql/describe.c 22 Jan 2009 20:16:08 -0000 1.198 --- src/bin/psql/describe.c 10 Feb 2009 18:13:36 -0000 *************** *** 8,14 **** * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.198 2009-01-22 20:16:08 tgl Exp $ */ #include "postgres_fe.h" --- 8,14 ---- * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.197 2009/01/20 02:13:42 momjian Exp $ */ #include "postgres_fe.h" *************** describeOneTableDetails(const char *sche *** 910,923 **** /* Get general table info */ printfPQExpBuffer(&buf, ! "SELECT relchecks, relkind, relhasindex, relhasrules, %s, " ! "relhasoids" "%s%s\n" ! "FROM pg_catalog.pg_class WHERE oid = '%s'", ! (pset.sversion >= 80400 ? "relhastriggers" : "reltriggers <> 0"), (pset.sversion >= 80200 && verbose ? ! ", pg_catalog.array_to_string(reloptions, E', ')" : ",''"), ! (pset.sversion >= 80000 ? ", reltablespace" : ""), oid); res = PSQLexec(buf.data, false); if (!res) --- 910,927 ---- /* Get general table info */ printfPQExpBuffer(&buf, ! "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, %s, " ! "c.relhasoids" "%s%s\n" ! "FROM pg_catalog.pg_class c " ! "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid) " ! "WHERE c.oid = '%s'", ! (pset.sversion >= 80400 ? "c.relhastriggers" : "c.reltriggers <> 0"), (pset.sversion >= 80200 && verbose ? ! ", pg_catalog.array_to_string(c.reloptions || " ! "array(select 'toast.' || x from unnest(tc.reloptions) x), ', ')" ! : ",''"), ! (pset.sversion >= 80000 ? ", c.reltablespace" : ""), oid); res = PSQLexec(buf.data, false); if (!res)
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers