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"> <chapter id="performance-tips">
...@@ -633,8 +633,9 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; ...@@ -633,8 +633,9 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
<sect2 id="disable-autocommit"> <sect2 id="disable-autocommit">
<title>Disable Autocommit</title> <title>Disable Autocommit</title>
<indexterm zone="disable-autocommit"> <indexterm>
<primary>autocommit</primary> <primary>autocommit</primary>
<secondary>bulk-loading data</secondary>
</indexterm> </indexterm>
<para> <para>
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2003, PostgreSQL Global Development Group * 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 "postgres_fe.h"
#include "describe.h" #include "describe.h"
...@@ -549,6 +549,8 @@ objectDescription(const char *pattern) ...@@ -549,6 +549,8 @@ objectDescription(const char *pattern)
* *
* This routine finds the tables to be displayed, and calls * This routine finds the tables to be displayed, and calls
* describeOneTableDetails for each one. * describeOneTableDetails for each one.
*
* verbose: if true, this is \d+
*/ */
bool bool
describeTableDetails(const char *pattern, bool verbose) describeTableDetails(const char *pattern, bool verbose)
...@@ -635,11 +637,12 @@ describeOneTableDetails(const char *schemaname, ...@@ -635,11 +637,12 @@ describeOneTableDetails(const char *schemaname,
int numrows = 0; int numrows = 0;
struct struct
{ {
bool hasindex;
char relkind;
int16 checks; int16 checks;
int16 triggers; int16 triggers;
char relkind;
bool hasindex;
bool hasrules; bool hasrules;
bool hasoids;
} tableinfo; } tableinfo;
bool show_modifiers = false; bool show_modifiers = false;
bool retval; bool retval;
...@@ -652,7 +655,7 @@ describeOneTableDetails(const char *schemaname, ...@@ -652,7 +655,7 @@ describeOneTableDetails(const char *schemaname,
/* Get general table info */ /* Get general table info */
printfPQExpBuffer(&buf, 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'", "FROM pg_catalog.pg_class WHERE oid = '%s'",
oid); oid);
res = PSQLexec(buf.data, false); res = PSQLexec(buf.data, false);
...@@ -669,11 +672,12 @@ describeOneTableDetails(const char *schemaname, ...@@ -669,11 +672,12 @@ describeOneTableDetails(const char *schemaname,
} }
/* FIXME: check for null pointers here? */ /* 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.checks = atoi(PQgetvalue(res, 0, 2));
tableinfo.triggers = atoi(PQgetvalue(res, 0, 3)); 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.hasrules = strcmp(PQgetvalue(res, 0, 4), "t") == 0;
tableinfo.hasoids = strcmp(PQgetvalue(res, 0, 5), "t") == 0;
PQclear(res); PQclear(res);
headers[0] = _("Column"); headers[0] = _("Column");
...@@ -1185,6 +1189,14 @@ describeOneTableDetails(const char *schemaname, ...@@ -1185,6 +1189,14 @@ describeOneTableDetails(const char *schemaname,
footers[count_footers++] = pg_strdup(buf.data); 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 */ /* end of list marker */
footers[count_footers] = NULL; 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