aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-04-22 17:38:16 +0000
committerNeil Conway <neilc@samurai.com>2004-04-22 17:38:16 +0000
commit0fa2afa93a75ee03960b9d5e2fcbd67ed6f9e8c6 (patch)
tree6e7089d004714648dfad0dd8b2a8e75f3f4bcd84 /src
parentb3bc93a4b76902a99aba1f6feb12745d99c3865d (diff)
downloadpostgresql-0fa2afa93a75ee03960b9d5e2fcbd67ed6f9e8c6.tar.gz
postgresql-0fa2afa93a75ee03960b9d5e2fcbd67ed6f9e8c6.zip
Make psql's \d+ command indicate whether the table in question
contains OIDs. Also, minor documentation improvements to the psql reference page.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/describe.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f37296a2cb6..1a0ed8c8819 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.96 2004/04/06 04:05:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.97 2004/04/22 17:38:16 neilc Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
@@ -549,6 +549,8 @@ objectDescription(const char *pattern)
*
* This routine finds the tables to be displayed, and calls
* describeOneTableDetails for each one.
+ *
+ * verbose: if true, this is \d+
*/
bool
describeTableDetails(const char *pattern, bool verbose)
@@ -635,11 +637,12 @@ describeOneTableDetails(const char *schemaname,
int numrows = 0;
struct
{
- bool hasindex;
- char relkind;
int16 checks;
int16 triggers;
+ char relkind;
+ bool hasindex;
bool hasrules;
+ bool hasoids;
} tableinfo;
bool show_modifiers = false;
bool retval;
@@ -652,7 +655,7 @@ describeOneTableDetails(const char *schemaname,
/* Get general table info */
printfPQExpBuffer(&buf,
- "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules\n"
+ "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules, relhasoids\n"
"FROM pg_catalog.pg_class WHERE oid = '%s'",
oid);
res = PSQLexec(buf.data, false);
@@ -669,11 +672,12 @@ describeOneTableDetails(const char *schemaname,
}
/* FIXME: check for null pointers here? */
- tableinfo.hasindex = strcmp(PQgetvalue(res, 0, 0), "t") == 0;
- tableinfo.relkind = *(PQgetvalue(res, 0, 1));
tableinfo.checks = atoi(PQgetvalue(res, 0, 2));
tableinfo.triggers = atoi(PQgetvalue(res, 0, 3));
+ tableinfo.relkind = *(PQgetvalue(res, 0, 1));
+ tableinfo.hasindex = strcmp(PQgetvalue(res, 0, 0), "t") == 0;
tableinfo.hasrules = strcmp(PQgetvalue(res, 0, 4), "t") == 0;
+ tableinfo.hasoids = strcmp(PQgetvalue(res, 0, 5), "t") == 0;
PQclear(res);
headers[0] = _("Column");
@@ -1185,6 +1189,14 @@ describeOneTableDetails(const char *schemaname,
footers[count_footers++] = pg_strdup(buf.data);
}
+ if (verbose)
+ {
+ char *s = _("Contains OIDs");
+ printfPQExpBuffer(&buf, "%s: %s", s,
+ (tableinfo.hasoids ? _("yes") : _("no")));
+ footers[count_footers++] = pg_strdup(buf.data);
+ }
+
/* end of list marker */
footers[count_footers] = NULL;