Skip to content

Commit 71e0296

Browse files
committed
Add column storage type to psql \d+ display.
Gregory Stark
1 parent c9b2591 commit 71e0296

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/bin/psql/describe.c

Lines changed: 22 additions & 10 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.177 2008/07/14 22:00:04 momjian Exp $
11+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.178 2008/07/14 22:51:48 momjian Exp $
1212
*/
1313
#include "postgres_fe.h"
1414

@@ -811,7 +811,7 @@ describeOneTableDetails(const char *schemaname,
811811
printTableContent cont;
812812
int i;
813813
char *view_def = NULL;
814-
char *headers[4];
814+
char *headers[5];
815815
char **modifiers = NULL;
816816
char **ptr;
817817
PQExpBufferData title;
@@ -878,7 +878,7 @@ describeOneTableDetails(const char *schemaname,
878878
"\n WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),"
879879
"\n a.attnotnull, a.attnum");
880880
if (verbose)
881-
appendPQExpBuffer(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)");
881+
appendPQExpBuffer(&buf, ", a.attstorage, pg_catalog.col_description(a.attrelid, a.attnum)");
882882
appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a");
883883
if (tableinfo.relkind == 'i')
884884
appendPQExpBuffer(&buf, ", pg_catalog.pg_index i");
@@ -933,19 +933,22 @@ describeOneTableDetails(const char *schemaname,
933933

934934
/* Set the number of columns, and their names */
935935
cols = 2;
936-
headers[0] = "Column";
937-
headers[1] = "Type";
936+
headers[0] = gettext_noop("Column");
937+
headers[1] = gettext_noop("Type");
938938

939939
if (tableinfo.relkind == 'r' || tableinfo.relkind == 'v')
940940
{
941941
show_modifiers = true;
942-
headers[cols++] = "Modifiers";
942+
headers[cols++] = gettext_noop("Modifiers");
943943
modifiers = pg_malloc_zero((numrows + 1) * sizeof(*modifiers));
944944
}
945945

946946
if (verbose)
947-
headers[cols++] = "Description";
948-
947+
{
948+
headers[cols++] = gettext_noop("Storage");
949+
headers[cols++] = gettext_noop("Description");
950+
}
951+
949952
printTableInit(&cont, &myopt, title.data, cols, numrows);
950953

951954
for (i = 0; i < cols; i++)
@@ -1000,9 +1003,18 @@ describeOneTableDetails(const char *schemaname,
10001003
printTableAddCell(&cont, modifiers[i], false);
10011004
}
10021005

1003-
/* Description */
1006+
/* Storage and Description */
10041007
if (verbose)
1005-
printTableAddCell(&cont, PQgetvalue(res, i, 5), false);
1008+
{
1009+
char *storage = PQgetvalue(res, i, 5);
1010+
printTableAddCell(&cont, (storage[0]=='p' ? "plain" :
1011+
(storage[0]=='m' ? "main" :
1012+
(storage[0]=='x' ? "extended" :
1013+
(storage[0]=='e' ? "external" :
1014+
"???")))),
1015+
false);
1016+
printTableAddCell(&cont, PQgetvalue(res, i, 6), false);
1017+
}
10061018
}
10071019

10081020
/* Make footers */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy