Commit 0fa2afa9 authored by Neil Conway's avatar Neil Conway

Make psql's \d+ command indicate whether the table in question

contains OIDs. Also, minor documentation improvements to the
psql reference page.
parent b3bc93a4
<!--
$PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.44 2004/04/22 07:02:36 neilc Exp $
$PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.45 2004/04/22 17:38:14 neilc Exp $
-->
<chapter id="performance-tips">
......@@ -633,8 +633,9 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
<sect2 id="disable-autocommit">
<title>Disable Autocommit</title>
<indexterm zone="disable-autocommit">
<indexterm>
<primary>autocommit</primary>
<secondary>bulk-loading data</secondary>
</indexterm>
<para>
......
This diff is collapsed.
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment