This patch makes psql's \d+ command indicate whether the table in question contains OIDs or not. I didn't add this information to \d, on the grounds that \d is more commonly used and few people will care whether the table as OIDs. Example output:
nconway=# create table t1 () with oids; CREATE TABLE nconway=# create table t2 () without oids; CREATE TABLE nconway=# \d+ t1 Table "public.t1" Column | Type | Modifiers | Description --------+------+-----------+------------- Contains OIDs: yes nconway=# \d+ t2 Table "public.t2" Column | Type | Modifiers | Description --------+------+-----------+------------- Contains OIDs: no I also fixed a bunch of markup in the psql reference manual (which takes up about 90% of the patch itself). Barring any objections I'll apply this patch within 24 hours. -Neil
Index: doc/src/sgml/perform.sgml =================================================================== RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/perform.sgml,v retrieving revision 1.43 diff -c -r1.43 perform.sgml *** a/doc/src/sgml/perform.sgml 25 Mar 2004 18:57:57 -0000 1.43 --- b/doc/src/sgml/perform.sgml 21 Apr 2004 23:16:14 -0000 *************** *** 633,640 **** <sect2 id="disable-autocommit"> <title>Disable Autocommit</title> ! <indexterm zone="disable-autocommit"> <primary>autocommit</primary> </indexterm> <para> --- 633,641 ---- <sect2 id="disable-autocommit"> <title>Disable Autocommit</title> ! <indexterm> <primary>autocommit</primary> + <secondary>bulk-loading data</secondary> </indexterm> <para> Index: doc/src/sgml/ref/psql-ref.sgml =================================================================== RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v retrieving revision 1.112 diff -c -r1.112 psql-ref.sgml *** a/doc/src/sgml/ref/psql-ref.sgml 21 Apr 2004 00:34:18 -0000 1.112 --- b/doc/src/sgml/ref/psql-ref.sgml 21 Apr 2004 23:24:03 -0000 *************** *** 637,643 **** </varlistentry> <varlistentry> ! <term><literal>\cd</literal> <optional><replaceable>directory</replaceable></optional></term> <listitem> <para> Changes the current working directory to --- 637,643 ---- </varlistentry> <varlistentry> ! <term><literal>\cd [ <replaceable>directory</replaceable> ] </literal></term> <listitem> <para> Changes the current working directory to *************** *** 654,660 **** </varlistentry> <varlistentry> ! <term><literal>\C</literal> [ <replaceable class="parameter">title</replaceable> ]</term> <listitem> <para> Sets the title of any tables being printed as the result of a --- 654,660 ---- </varlistentry> <varlistentry> ! <term><literal>\C [ <replaceable class="parameter">title</replaceable> ]</literal></term> <listitem> <para> Sets the title of any tables being printed as the result of a *************** *** 669,675 **** </varlistentry> <varlistentry> ! <term><literal>\connect</literal> (or <literal>\c</literal>) [ <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] ]</term> <listitem> <para> Establishes a connection to a new database and/or under a user --- 669,675 ---- </varlistentry> <varlistentry> ! <term><literal>\connect</literal> (or <literal>\c</literal>) <literal>[ <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] ]</literal></term> <listitem> <para> Establishes a connection to a new database and/or under a user *************** *** 707,720 **** [ ( <replaceable class="parameter">column_list</replaceable> ) ] { <literal>from</literal> | <literal>to</literal> } { <replaceable class="parameter">filename</replaceable> | stdin | stdout | pstdin | pstdout } ! [ <literal>with</literal> ] ! [ <literal>oids</literal> ] ! [ <literal>delimiter [as] </literal> '<replaceable class="parameter">character</replaceable>' ] ! [ <literal>null [as] </literal> '<replaceable class="parameter">string</replaceable>' ]</literal> ! [ <literal>csv [ quote [as] </literal> '<replaceable class="parameter">character</replaceable>' ] ! [ <literal>escape [as] </literal> '<replaceable class="parameter">character</replaceable>' ] ! [ <literal>force quote</> <replaceable class="parameter">column_list</replaceable> ] ! [ <literal>force not null</> <replaceable class="parameter">column_list</replaceable> ] ] </term> <listitem> --- 707,720 ---- [ ( <replaceable class="parameter">column_list</replaceable> ) ] { <literal>from</literal> | <literal>to</literal> } { <replaceable class="parameter">filename</replaceable> | stdin | stdout | pstdin | pstdout } ! [ with ] ! [ oids ] ! [ delimiter [ as ] '<replaceable class="parameter">character</replaceable>' ] ! [ null [ as ] '<replaceable class="parameter">string</replaceable>' ] ! [ csv [ quote [ as ] '<replaceable class="parameter">character</replaceable>' ] ! [ escape [ as ] '<replaceable class="parameter">character</replaceable>' ] ! [ force quote <replaceable class="parameter">column_list</replaceable> ] ! [ force not null <replaceable class="parameter">column_list</replaceable> ] ]</literal> </term> <listitem> *************** *** 776,782 **** </varlistentry> <varlistentry> ! <term><literal>\d</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> --- 776,783 ---- </varlistentry> <varlistentry> ! <term><literal>\d [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> ! <term><literal>\d+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> *************** *** 790,797 **** </para> <para> ! The command form <literal>\d+</literal> is identical, but any ! comments associated with the table columns are shown as well. </para> <note> --- 791,800 ---- </para> <para> ! The command form <literal>\d+</literal> is identical, except that ! more information is displayed: any comments associated with the ! columns of the table are shown, as is the presence of OIDs in the ! table. </para> <note> *************** *** 807,813 **** </varlistentry> <varlistentry> ! <term><literal>\da</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> --- 810,816 ---- </varlistentry> <varlistentry> ! <term><literal>\da [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> *************** *** 821,827 **** <varlistentry> ! <term><literal>\dc</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> Lists all available conversions between character-set encodings. --- 824,830 ---- <varlistentry> ! <term><literal>\dc [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Lists all available conversions between character-set encodings. *************** *** 844,850 **** <varlistentry> ! <term><literal>\dd</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> Shows the descriptions of objects matching the <replaceable --- 847,853 ---- <varlistentry> ! <term><literal>\dd [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Shows the descriptions of objects matching the <replaceable *************** *** 865,879 **** </para> <para> ! Descriptions for objects can be created with the ! <command>COMMENT</command> <acronym>SQL</acronym> command. ! </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>\dD</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> Lists all available domains. If <replaceable --- 868,883 ---- </para> <para> ! Descriptions for objects can be created with the <xref ! linkend="sql-comment" endterm="sql-comment-title"> ! <acronym>SQL</acronym> command. ! </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>\dD [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Lists all available domains. If <replaceable *************** *** 886,891 **** --- 890,896 ---- <varlistentry> <term><literal>\df [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> + <term><literal>\df+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> *************** *** 919,926 **** <term><literal>\dg [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> ! Lists all database groups or only those that match <replaceable ! class="parameter">pattern</replaceable>. </para> </listitem> </varlistentry> --- 924,932 ---- <term><literal>\dg [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> ! Lists all database groups. If <replaceable ! class="parameter">pattern</replaceable> is specified, only ! those groups whose names match the pattern are listed. </para> </listitem> </varlistentry> *************** *** 931,944 **** <listitem> <para> ! This is not the actual command name: the letters i, s, t, v, S ! stand for index, sequence, table, view, and system table, ! respectively. You can specify any or all of these letters, in any ! order, to obtain a listing of all the matching objects. The letter ! S restricts the listing to system objects; without S, only non-system ! objects are shown. ! If <literal>+</literal> is appended to the command name, each object is ! listed with its associated description, if any. </para> <para> --- 937,952 ---- <listitem> <para> ! This is not the actual command name: the letters ! <literal>i</literal>, <literal>s</literal>, <literal>t</literal>, ! <literal>v</literal>, <literal>S</literal> stand for index, ! sequence, table, view, and system table, respectively. You can ! specify any or all of these letters, in any order, to obtain a ! listing of all the matching objects. The letter S restricts the ! listing to system objects; without <literal>S</literal>, only ! non-system objects are shown. If <literal>+</literal> is appended ! to the command name, each object is listed with its associated ! description, if any. </para> <para> *************** *** 961,967 **** <varlistentry> ! <term><literal>\dn</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> --- 969,975 ---- <varlistentry> ! <term><literal>\dn [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> *************** *** 987,993 **** <varlistentry> ! <term><literal>\dp</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> Produces a list of all available tables, views and sequences with their --- 995,1001 ---- <varlistentry> ! <term><literal>\dp [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Produces a list of all available tables, views and sequences with their *************** *** 1008,1013 **** --- 1016,1022 ---- <varlistentry> <term><literal>\dT [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> + <term><literal>\dT+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Lists all data types or only those that match <replaceable *************** *** 1030,1036 **** <varlistentry> ! <term><literal>\edit</literal> (or <literal>\e</literal>) [ <replaceable class="parameter">filename</replaceable> ]</term> <listitem> <para> --- 1039,1045 ---- <varlistentry> ! <term><literal>\edit</literal> (or <literal>\e</literal>) <literal>[ <replaceable class="parameter">filename</replaceable> ]</literal></term> <listitem> <para> *************** *** 1064,1070 **** <varlistentry> ! <term><literal>\echo</literal> <replaceable class="parameter">text</replaceable> [ ... ]</term> <listitem> <para> Prints the arguments to the standard output, separated by one --- 1073,1079 ---- <varlistentry> ! <term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term> <listitem> <para> Prints the arguments to the standard output, separated by one *************** *** 1090,1096 **** <varlistentry> ! <term><literal>\encoding</literal> [ <replaceable class="parameter">encoding</replaceable> ]</term> <listitem> <para> --- 1099,1105 ---- <varlistentry> ! <term><literal>\encoding [ <replaceable class="parameter">encoding</replaceable> ]</literal></term> <listitem> <para> *************** *** 1102,1108 **** <varlistentry> ! <term><literal>\f</literal> [ <replaceable class="parameter">string</replaceable> ]</term> <listitem> <para> --- 1111,1117 ---- <varlistentry> ! <term><literal>\f [ <replaceable class="parameter">string</replaceable> ]</literal></term> <listitem> <para> *************** *** 1133,1139 **** </varlistentry> <varlistentry> ! <term><literal>\help</literal> (or <literal>\h</literal>) [ <replaceable class="parameter">command</replaceable> ]</term> <listitem> <para> Gives syntax help on the specified <acronym>SQL</acronym> --- 1142,1148 ---- </varlistentry> <varlistentry> ! <term><literal>\help</literal> (or <literal>\h</literal>) <literal>[ <replaceable class="parameter">command</replaceable> ]</literal></term> <listitem> <para> Gives syntax help on the specified <acronym>SQL</acronym> *************** *** 1171,1177 **** <varlistentry> ! <term><literal>\i</literal> <replaceable class="parameter">filename</replaceable></term> <listitem> <para> Reads input from the file <replaceable --- 1180,1186 ---- <varlistentry> ! <term><literal>\i <replaceable class="parameter">filename</replaceable></literal></term> <listitem> <para> Reads input from the file <replaceable *************** *** 1191,1208 **** <varlistentry> <term><literal>\l</literal> (or <literal>\list</literal>)</term> <listitem> <para> List the names, owners, and character set encodings of all the databases in ! the server. Append a <literal>+</literal> to the command name to ! see any descriptions for the databases as well. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>\lo_export</literal> <replaceable class="parameter">loid</replaceable> <replaceable class="parameter">filename</replaceable></term> <listitem> <para> --- 1200,1218 ---- <varlistentry> <term><literal>\l</literal> (or <literal>\list</literal>)</term> + <term><literal>\l+</literal> (or <literal>\list+</literal>)</term> <listitem> <para> List the names, owners, and character set encodings of all the databases in ! the server. If <literal>+</literal> is appended to the command ! name, database descriptions are also displayed. </para> </listitem> </varlistentry> <varlistentry> ! <term><literal>\lo_export <replaceable class="parameter">loid</replaceable> <replaceable class="parameter">filename</replaceable></literal></term> <listitem> <para> *************** *** 1226,1232 **** <varlistentry> ! <term><literal>\lo_import</literal> <replaceable class="parameter">filename</replaceable> [ <replaceable class="parameter">comment</replaceable> ]</term> <listitem> <para> --- 1236,1242 ---- <varlistentry> ! <term><literal>\lo_import <replaceable class="parameter">filename</replaceable> [ <replaceable class="parameter">comment</replaceable> ]</literal></term> <listitem> <para> *************** *** 1265,1271 **** </varlistentry> <varlistentry> ! <term><literal>\lo_unlink</literal> <replaceable class="parameter">loid</replaceable></term> <listitem> <para> --- 1275,1281 ---- </varlistentry> <varlistentry> ! <term><literal>\lo_unlink <replaceable class="parameter">loid</replaceable></literal></term> <listitem> <para> *************** *** 1325,1331 **** <varlistentry> ! <term><literal>\pset</literal> <replaceable class="parameter">parameter</replaceable> [ <replaceable class="parameter">value</replaceable> ]</term> <listitem> <para> --- 1335,1341 ---- <varlistentry> ! <term><literal>\pset <replaceable class="parameter">parameter</replaceable> [ <replaceable class="parameter">value</replaceable> ]</literal></term> <listitem> <para> *************** *** 1458,1464 **** </varlistentry> <varlistentry> ! <term><literal>title</literal> [ <replaceable class="parameter">text</replaceable> ]</term> <listitem> <para> Sets the table title for any subsequently printed tables. This --- 1468,1474 ---- </varlistentry> <varlistentry> ! <term><literal>title [ <replaceable class="parameter">text</replaceable> ]</literal></term> <listitem> <para> Sets the table title for any subsequently printed tables. This *************** *** 1469,1475 **** </varlistentry> <varlistentry> ! <term><literal>tableattr</literal> (or <literal>T</literal>) [ <replaceable class="parameter">text</replaceable> ]</term> <listitem> <para> Allows you to specify any attributes to be placed inside the --- 1479,1485 ---- </varlistentry> <varlistentry> ! <term><literal>tableattr</literal> (or <literal>T</literal>) <literal>[ <replaceable class="parameter">text</replaceable> ]</literal></term> <listitem> <para> Allows you to specify any attributes to be placed inside the *************** *** 1545,1551 **** <varlistentry> ! <term><literal>\qecho</literal> <replaceable class="parameter">text</replaceable> [ ... ] </term> <listitem> <para> This command is identical to <command>\echo</command> except --- 1555,1561 ---- <varlistentry> ! <term><literal>\qecho <replaceable class="parameter">text</replaceable> [ ... ] </literal></term> <listitem> <para> This command is identical to <command>\echo</command> except *************** *** 1567,1573 **** <varlistentry> ! <term><literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]</term> <listitem> <para> Print or save the command line history to <replaceable --- 1577,1583 ---- <varlistentry> ! <term><literal>\s [ <replaceable class="parameter">filename</replaceable> ]</literal></term> <listitem> <para> Print or save the command line history to <replaceable *************** *** 1591,1597 **** <varlistentry> ! <term><literal>\set</literal> [ <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> [ ... ]]]</term> <listitem> <para> --- 1601,1607 ---- <varlistentry> ! <term><literal>\set [ <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> [ ... ] ] ]</literal></term> <listitem> <para> *************** *** 1640,1646 **** <varlistentry> ! <term><literal>\T</literal> <replaceable class="parameter">table_options</replaceable></term> <listitem> <para> Allows you to specify attributes to be placed within the --- 1650,1656 ---- <varlistentry> ! <term><literal>\T <replaceable class="parameter">table_options</replaceable></literal></term> <listitem> <para> Allows you to specify attributes to be placed within the *************** *** 1687,1693 **** <varlistentry> ! <term><literal>\z</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term> <listitem> <para> Produces a list of all available tables, views and sequences with their --- 1697,1703 ---- <varlistentry> ! <term><literal>\z [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Produces a list of all available tables, views and sequences with their *************** *** 1712,1718 **** <varlistentry> ! <term><literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]</term> <listitem> <para> Escapes to a separate Unix shell or executes the Unix command --- 1722,1728 ---- <varlistentry> ! <term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term> <listitem> <para> Escapes to a separate Unix shell or executes the Unix command *************** *** 1831,1836 **** --- 1841,1850 ---- <variablelist> <varlistentry> + <indexterm> + <primary>autocommit</primary> + <secondary>psql</secondary> + </indexterm> <term><varname>AUTOCOMMIT</varname></term> <listitem> <para> Index: src/bin/psql/describe.c =================================================================== RCS file: /var/lib/cvs/pgsql-server/src/bin/psql/describe.c,v retrieving revision 1.96 diff -c -r1.96 describe.c *** a/src/bin/psql/describe.c 6 Apr 2004 04:05:17 -0000 1.96 --- b/src/bin/psql/describe.c 21 Apr 2004 22:36:09 -0000 *************** *** 549,554 **** --- 549,556 ---- * * 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,645 **** int numrows = 0; struct { - bool hasindex; - char relkind; int16 checks; int16 triggers; bool hasrules; } tableinfo; bool show_modifiers = false; bool retval; --- 637,648 ---- int numrows = 0; struct { int16 checks; int16 triggers; + char relkind; + bool hasindex; bool hasrules; + bool hasoids; } tableinfo; bool show_modifiers = false; bool retval; *************** *** 652,658 **** /* Get general table info */ printfPQExpBuffer(&buf, ! "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules\n" "FROM pg_catalog.pg_class WHERE oid = '%s'", oid); res = PSQLexec(buf.data, false); --- 655,661 ---- /* Get general table info */ printfPQExpBuffer(&buf, ! "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules, relhasoids\n" "FROM pg_catalog.pg_class WHERE oid = '%s'", oid); res = PSQLexec(buf.data, false); *************** *** 669,679 **** } /* 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.hasrules = strcmp(PQgetvalue(res, 0, 4), "t") == 0; PQclear(res); headers[0] = _("Column"); --- 672,683 ---- } /* FIXME: check for null pointers here? */ 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,1190 **** --- 1189,1201 ---- 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;
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly