[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pgsql-patches
Subject:    [PATCHES] \d+ should display the storage options for columns
From:       Gregory Stark <stark () enterprisedb ! com>
Date:       2008-05-21 20:30:28
Message-ID: 87d4nfo0wr.fsf () oxford ! xeocode ! com
[Download RAW message or body]


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+


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 18:07:13 -0000
***************
*** 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 ****
--- 958,979 ----
  
  		/* Description */
  		if (verbose)
+ 		{
+ 			char *storage = PQgetvalue(res, i, 6);
+ 
+ 			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, 5), myopt.encoding);
  #else
  			cells[i * cols + cols - 1] = PQgetvalue(res, i, 5);
  #endif
+ 		}
  	}
  
  	/* Make title */


-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

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

Configure | About | News | Add a list | Sponsored by KoreLogic