"Gregory Stark" <[EMAIL PROTECTED]> writes:

> Oleg pointed out to me here that while we have a command to *set* the toast
> storage characteristics there's no actual supported way to display the current
> settings.
>
> It seems like this would be a reasonable thing to add to \d+

Sorry, sent the wrong diff before. The previous diff didn't work due to an
array overflow.

Index: src/bin/psql/describe.c
===================================================================
RCS file: /home/stark/src/REPOSITORY/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.170
diff -c -r1.170 describe.c
*** src/bin/psql/describe.c     5 May 2008 01:21:03 -0000       1.170
--- src/bin/psql/describe.c     21 May 2008 20:25:26 -0000
***************
*** 791,797 ****
        printTableOpt myopt = pset.popt.topt;
        int                     i;
        char       *view_def = NULL;
!       const char *headers[5];
        char      **cells = NULL;
        char      **footers = NULL;
        char      **ptr;
--- 791,797 ----
        printTableOpt myopt = pset.popt.topt;
        int                     i;
        char       *view_def = NULL;
!       const char *headers[6];
        char      **cells = NULL;
        char      **footers = NULL;
        char      **ptr;
***************
*** 865,871 ****
  
        if (verbose)
        {
!               cols++;
                headers[cols - 1] = _("Description");
        }
  
--- 865,872 ----
  
        if (verbose)
        {
!               cols+=2;
!               headers[cols - 2] = _("Storage");
                headers[cols - 1] = _("Description");
        }
  
***************
*** 877,883 ****
                                          "\n  (SELECT 
substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)"
                                          "\n   FROM pg_catalog.pg_attrdef d"
                                          "\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");
--- 878,884 ----
                                          "\n  (SELECT 
substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)"
                                          "\n   FROM pg_catalog.pg_attrdef d"
                                          "\n   WHERE d.adrelid = a.attrelid 
AND d.adnum = a.attnum AND a.atthasdef),"
!                                         "\n  a.attnotnull, a.attnum, 
a.attstorage");
        if (verbose)
                appendPQExpBuffer(&buf, ", 
pg_catalog.col_description(a.attrelid, a.attnum)");
        appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a");
***************
*** 957,967 ****
  
                /* Description */
                if (verbose)
  #ifdef WIN32
!                       cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, 
i, 5), myopt.encoding);
  #else
!                       cells[i * cols + cols - 1] = PQgetvalue(res, i, 5);
  #endif
        }
  
        /* Make title */
--- 958,978 ----
  
                /* Description */
                if (verbose)
+               {
+                       char *storage = PQgetvalue(res, i, 5);
+ 
+                       cells[i * cols + cols -2] = 
+                               (storage[0]=='p' ? _("plain") :
+                                (storage[0]=='m' ? _("main") :
+                                 (storage[0]=='x' ? _("extended") :
+                                  (storage[0]=='e' ? _("external") :
+                                       "???"))));
  #ifdef WIN32
!                       cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, 
i, 6), myopt.encoding);
  #else
!                       cells[i * cols + cols - 1] = PQgetvalue(res, i, 6);
  #endif
+               }
        }
  
        /* Make title */

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL 
training!

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to