88 *
99 * Copyright (c) 2000-2008, PostgreSQL Global Development Group
1010 *
11- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.188 2008/11/09 21:24:33 tgl Exp $
11+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.189 2008/12/19 14:39:58 alvherre Exp $
1212 */
1313#include "postgres_fe.h"
1414
@@ -846,6 +846,7 @@ describeOneTableDetails(const char *schemaname,
846846bool hastriggers ;
847847bool hasoids ;
848848Oid tablespace ;
849+ char * reloptions ;
849850}tableinfo ;
850851bool show_modifiers = false;
851852bool retval ;
@@ -862,9 +863,12 @@ describeOneTableDetails(const char *schemaname,
862863/* Get general table info */
863864printfPQExpBuffer (& buf ,
864865"SELECT relchecks, relkind, relhasindex, relhasrules, %s, "
865- "relhasoids%s\n"
866+ "relhasoids"
867+ "%s%s\n"
866868"FROM pg_catalog.pg_class WHERE oid = '%s'" ,
867869 (pset .sversion >=80400 ?"relhastriggers" :"reltriggers <> 0" ),
870+ (pset .sversion >=80200 && verbose ?
871+ ", pg_catalog.array_to_string(reloptions, E', ')" :",''" ),
868872 (pset .sversion >=80000 ?", reltablespace" :"" ),
869873oid );
870874res = PSQLexec (buf .data , false);
@@ -886,8 +890,10 @@ describeOneTableDetails(const char *schemaname,
886890tableinfo .hasrules = strcmp (PQgetvalue (res ,0 ,3 ),"t" )== 0 ;
887891tableinfo .hastriggers = strcmp (PQgetvalue (res ,0 ,4 ),"t" )== 0 ;
888892tableinfo .hasoids = strcmp (PQgetvalue (res ,0 ,5 ),"t" )== 0 ;
893+ tableinfo .reloptions = pset .sversion >=80200 ?
894+ strdup (PQgetvalue (res ,0 ,6 )) :0 ;
889895tableinfo .tablespace = (pset .sversion >=80000 ) ?
890- atooid (PQgetvalue (res ,0 ,6 )) :0 ;
896+ atooid (PQgetvalue (res ,0 ,7 )) :0 ;
891897PQclear (res );
892898res = NULL ;
893899
@@ -1586,6 +1592,19 @@ describeOneTableDetails(const char *schemaname,
15861592printfPQExpBuffer (& buf ,"%s: %s" ,s ,
15871593 (tableinfo .hasoids ?_ ("yes" ) :_ ("no" )));
15881594printTableAddFooter (& cont ,buf .data );
1595+
1596+ /* print reloptions */
1597+ if (pset .sversion >=80200 )
1598+ {
1599+ if (tableinfo .reloptions && tableinfo .reloptions [0 ]!= '\0' )
1600+ {
1601+ const char * t = _ ("Options" );
1602+
1603+ printfPQExpBuffer (& buf ,"%s: %s" ,t ,
1604+ tableinfo .reloptions );
1605+ printTableAddFooter (& cont ,buf .data );
1606+ }
1607+ }
15891608}
15901609
15911610add_tablespace_footer (& cont ,tableinfo .relkind ,tableinfo .tablespace ,