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

Commitebcadba

Browse files
committed
Show statistics target for columns in \d+ on a table
1 parent6f81a1f commitebcadba

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/bin/psql/describe.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ describeOneTableDetails(const char *schemaname,
12801280
if (verbose)
12811281
{
12821282
appendPQExpBuffer(&buf,",\n a.attstorage");
1283+
appendPQExpBuffer(&buf,",\n CASE WHEN a.attstattarget=-1 THEN NULL ELSE a.attstattarget END AS attstattarget");
12831284
/*
12841285
* In 9.0+, we have column comments for: relations, views, composite
12851286
* types, and foreign tables (c.f. CommentObject() in comment.c).
@@ -1374,6 +1375,8 @@ describeOneTableDetails(const char *schemaname,
13741375
if (verbose)
13751376
{
13761377
headers[cols++]=gettext_noop("Storage");
1378+
if (tableinfo.relkind=='r')
1379+
headers[cols++]=gettext_noop("Stats target");
13771380
/* Column comments, if the relkind supports this feature. */
13781381
if (tableinfo.relkind=='r'||tableinfo.relkind=='v'||
13791382
tableinfo.relkind=='c'||tableinfo.relkind=='f')
@@ -1473,10 +1476,18 @@ describeOneTableDetails(const char *schemaname,
14731476
(storage[0]=='e' ?"external" :
14741477
"???")))),
14751478
false, false);
1479+
1480+
/* Statistics target, if the relkind supports this feature */
1481+
if (tableinfo.relkind=='r')
1482+
{
1483+
printTableAddCell(&cont,PQgetvalue(res,i,firstvcol+1),
1484+
false, false);
1485+
}
1486+
14761487
/* Column comments, if the relkind supports this feature. */
14771488
if (tableinfo.relkind=='r'||tableinfo.relkind=='v'||
14781489
tableinfo.relkind=='c'||tableinfo.relkind=='f')
1479-
printTableAddCell(&cont,PQgetvalue(res,i,firstvcol+1),
1490+
printTableAddCell(&cont,PQgetvalue(res,i,firstvcol+2),
14801491
false, false);
14811492
}
14821493
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp