8
8
*
9
9
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
10
10
*
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 $
12
12
*/
13
13
#include "postgres_fe.h"
14
14
@@ -846,6 +846,7 @@ describeOneTableDetails(const char *schemaname,
846
846
bool hastriggers ;
847
847
bool hasoids ;
848
848
Oid tablespace ;
849
+ char * reloptions ;
849
850
} tableinfo ;
850
851
bool show_modifiers = false;
851
852
bool retval ;
@@ -862,9 +863,12 @@ describeOneTableDetails(const char *schemaname,
862
863
/* Get general table info */
863
864
printfPQExpBuffer (& buf ,
864
865
"SELECT relchecks, relkind, relhasindex, relhasrules, %s, "
865
- "relhasoids%s\n"
866
+ "relhasoids"
867
+ "%s%s\n"
866
868
"FROM pg_catalog.pg_class WHERE oid = '%s'" ,
867
869
(pset .sversion >= 80400 ? "relhastriggers" : "reltriggers <> 0" ),
870
+ (pset .sversion >= 80200 && verbose ?
871
+ ", pg_catalog.array_to_string(reloptions, E', ')" : ",''" ),
868
872
(pset .sversion >= 80000 ? ", reltablespace" : "" ),
869
873
oid );
870
874
res = PSQLexec (buf .data , false);
@@ -886,8 +890,10 @@ describeOneTableDetails(const char *schemaname,
886
890
tableinfo .hasrules = strcmp (PQgetvalue (res , 0 , 3 ), "t" ) == 0 ;
887
891
tableinfo .hastriggers = strcmp (PQgetvalue (res , 0 , 4 ), "t" ) == 0 ;
888
892
tableinfo .hasoids = strcmp (PQgetvalue (res , 0 , 5 ), "t" ) == 0 ;
893
+ tableinfo .reloptions = pset .sversion >= 80200 ?
894
+ strdup (PQgetvalue (res , 0 , 6 )) : 0 ;
889
895
tableinfo .tablespace = (pset .sversion >= 80000 ) ?
890
- atooid (PQgetvalue (res , 0 , 6 )) : 0 ;
896
+ atooid (PQgetvalue (res , 0 , 7 )) : 0 ;
891
897
PQclear (res );
892
898
res = NULL ;
893
899
@@ -1586,6 +1592,19 @@ describeOneTableDetails(const char *schemaname,
1586
1592
printfPQExpBuffer (& buf , "%s: %s" , s ,
1587
1593
(tableinfo .hasoids ? _ ("yes" ) : _ ("no" )));
1588
1594
printTableAddFooter (& 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
+ }
1589
1608
}
1590
1609
1591
1610
add_tablespace_footer (& cont , tableinfo .relkind , tableinfo .tablespace ,
0 commit comments