Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1eec10a

Browse files
committed
Have psql's \d+ print reloptions. Extracted from Euler Taveira de Oliveira's
reloptions patch for autovacuum and revised by me.Note that there doesn't seem to be a way to display an index's reloptions.
1 parentadac22b commit1eec10a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

‎src/bin/psql/describe.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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,
846846
boolhastriggers;
847847
boolhasoids;
848848
Oidtablespace;
849+
char*reloptions;
849850
}tableinfo;
850851
boolshow_modifiers= false;
851852
boolretval;
@@ -862,9 +863,12 @@ describeOneTableDetails(const char *schemaname,
862863
/* Get general table info */
863864
printfPQExpBuffer(&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" :""),
869873
oid);
870874
res=PSQLexec(buf.data, false);
@@ -886,8 +890,10 @@ describeOneTableDetails(const char *schemaname,
886890
tableinfo.hasrules=strcmp(PQgetvalue(res,0,3),"t")==0;
887891
tableinfo.hastriggers=strcmp(PQgetvalue(res,0,4),"t")==0;
888892
tableinfo.hasoids=strcmp(PQgetvalue(res,0,5),"t")==0;
893+
tableinfo.reloptions=pset.sversion >=80200 ?
894+
strdup(PQgetvalue(res,0,6)) :0;
889895
tableinfo.tablespace= (pset.sversion >=80000) ?
890-
atooid(PQgetvalue(res,0,6)) :0;
896+
atooid(PQgetvalue(res,0,7)) :0;
891897
PQclear(res);
892898
res=NULL;
893899

@@ -1586,6 +1592,19 @@ describeOneTableDetails(const char *schemaname,
15861592
printfPQExpBuffer(&buf,"%s: %s",s,
15871593
(tableinfo.hasoids ?_("yes") :_("no")));
15881594
printTableAddFooter(&cont,buf.data);
1595+
1596+
/* print reloptions */
1597+
if (pset.sversion >=80200)
1598+
{
1599+
if (tableinfo.reloptions&&tableinfo.reloptions[0]!='\0')
1600+
{
1601+
constchar*t=_("Options");
1602+
1603+
printfPQExpBuffer(&buf,"%s: %s",t,
1604+
tableinfo.reloptions);
1605+
printTableAddFooter(&cont,buf.data);
1606+
}
1607+
}
15891608
}
15901609

15911610
add_tablespace_footer(&cont,tableinfo.relkind,tableinfo.tablespace,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp