Re: \d+ should display the storage options for columns - Mailing list pgsql-patches
From | Gregory Stark |
---|---|
Subject | Re: \d+ should display the storage options for columns |
Date | |
Msg-id | 87d4ncu9y9.fsf@oxford.xeocode.com Whole thread Raw |
In response to | Re: \d+ should display the storage options for columns (Alvaro Herrera <alvherre@commandprompt.com>) |
Responses |
Re: \d+ should display the storage options for columns
Re: \d+ should display the storage options for columns |
List | pgsql-patches |
"Alvaro Herrera" <alvherre@commandprompt.com> writes: > This seems to be against an older version of psql ... with the > printTable API stuff, we reworked this -- in particular the mbvalidate() > call that's only on WIN32 is gone (actually it's the lack of it that's > gone.) Sorry. Here's a patch against a current sync of HEAD. Incidentally how can this new API work? Calling _() on a function parameter would work but how would the translation tools know what strings need to be translated? Index: src/bin/psql/describe.c =================================================================== RCS file: /home/stark/src/REPOSITORY/pgsql/src/bin/psql/describe.c,v retrieving revision 1.173 diff -c -r1.173 describe.c *** src/bin/psql/describe.c 13 May 2008 00:23:17 -0000 1.173 --- src/bin/psql/describe.c 23 May 2008 18:52:57 -0000 *************** *** 784,790 **** printTableContent cont; int i; char *view_def = NULL; ! char *headers[4]; char **modifiers = NULL; char **ptr; PQExpBufferData title; --- 784,790 ---- printTableContent cont; int i; char *view_def = NULL; ! char *headers[5]; char **modifiers = NULL; char **ptr; PQExpBufferData title; *************** *** 852,858 **** "\n WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef)," "\n a.attnotnull, a.attnum"); if (verbose) ! appendPQExpBuffer(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a"); if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ", pg_catalog.pg_index i"); --- 852,858 ---- "\n WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef)," "\n a.attnotnull, a.attnum"); if (verbose) ! appendPQExpBuffer(&buf, ", a.attstorage, pg_catalog.col_description(a.attrelid, a.attnum)"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a"); if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ", pg_catalog.pg_index i"); *************** *** 918,924 **** --- 918,927 ---- } if (verbose) + { + headers[cols++] = "Storage"; headers[cols++] = "Description"; + } printTableInit(&cont, &myopt, title.data, cols, numrows); *************** *** 972,980 **** printTableAddCell(&cont, modifiers[i], false); } ! /* Description */ if (verbose) ! printTableAddCell(&cont, PQgetvalue(res, i, 5), false); } /* Make footers */ --- 975,992 ---- printTableAddCell(&cont, modifiers[i], false); } ! /* Storage and Description */ if (verbose) ! { ! char *storage = PQgetvalue(res, i, 5); ! printTableAddCell(&cont, (storage[0]=='p' ? "plain" : ! (storage[0]=='m' ? "main" : ! (storage[0]=='x' ? "extended" : ! (storage[0]=='e' ? "external" : ! "???")))), ! false); ! printTableAddCell(&cont, PQgetvalue(res, i, 6), false); ! } } /* Make footers */ -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!
pgsql-patches by date: