Commit 2b25e116 authored by Peter Eisentraut's avatar Peter Eisentraut

The -X option in pg_dump was supposed to be a workaround for the lack of

portable long options.  But we have had portable long options for a long
time now, so this is obsolete.  Now people have added options which *only*
work with -X but not as regular long option, so I'm putting a stop to this:
-X is deprecated; it still works, but it has been removed from the
documentation, and please don't add more of them.
parent dc9142f4
<!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.58 2006/09/16 00:30:14 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.59 2006/10/07 20:59:03 petere Exp $ -->
<chapter id="performance-tips"> <chapter id="performance-tips">
<title>Performance Tips</title> <title>Performance Tips</title>
...@@ -926,7 +926,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; ...@@ -926,7 +926,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
<footnote> <footnote>
<para> <para>
You can get the effect of disabling foreign keys by using You can get the effect of disabling foreign keys by using
the <option>-X disable-triggers</> option &mdash; but realize that the <option>--disable-triggers</> option &mdash; but realize that
that eliminates, rather than just postponing, foreign key that eliminates, rather than just postponing, foreign key
validation, and so it is possible to insert bad data if you use it. validation, and so it is possible to insert bad data if you use it.
</para> </para>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.88 2006/09/16 00:30:19 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.89 2006/10/07 20:59:04 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -524,7 +524,6 @@ PostgreSQL documentation ...@@ -524,7 +524,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X disable-dollar-quoting</></term>
<term><option>--disable-dollar-quoting</></term> <term><option>--disable-dollar-quoting</></term>
<listitem> <listitem>
<para> <para>
...@@ -535,7 +534,6 @@ PostgreSQL documentation ...@@ -535,7 +534,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X disable-triggers</></term>
<term><option>--disable-triggers</></term> <term><option>--disable-triggers</></term>
<listitem> <listitem>
<para> <para>
...@@ -563,7 +561,6 @@ PostgreSQL documentation ...@@ -563,7 +561,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X use-set-session-authorization</></term>
<term><option>--use-set-session-authorization</></term> <term><option>--use-set-session-authorization</></term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.57 2006/09/16 00:30:19 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.58 2006/10/07 20:59:04 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -241,7 +241,6 @@ PostgreSQL documentation ...@@ -241,7 +241,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X disable-dollar-quoting</></term>
<term><option>--disable-dollar-quoting</></term> <term><option>--disable-dollar-quoting</></term>
<listitem> <listitem>
<para> <para>
...@@ -252,7 +251,6 @@ PostgreSQL documentation ...@@ -252,7 +251,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X disable-triggers</></term>
<term><option>--disable-triggers</></term> <term><option>--disable-triggers</></term>
<listitem> <listitem>
<para> <para>
...@@ -274,7 +272,6 @@ PostgreSQL documentation ...@@ -274,7 +272,6 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X use-set-session-authorization</></term>
<term><option>--use-set-session-authorization</></term> <term><option>--use-set-session-authorization</></term>
<listitem> <listitem>
<para> <para>
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.61 2006/09/16 00:30:19 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.62 2006/10/07 20:59:04 petere Exp $ -->
<refentry id="APP-PGRESTORE"> <refentry id="APP-PGRESTORE">
<refmeta> <refmeta>
...@@ -361,7 +361,6 @@ ...@@ -361,7 +361,6 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X disable-triggers</></term>
<term><option>--disable-triggers</></term> <term><option>--disable-triggers</></term>
<listitem> <listitem>
<para> <para>
...@@ -384,7 +383,6 @@ ...@@ -384,7 +383,6 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X use-set-session-authorization</option></term>
<term><option>--use-set-session-authorization</option></term> <term><option>--use-set-session-authorization</option></term>
<listitem> <listitem>
<para> <para>
...@@ -398,7 +396,7 @@ ...@@ -398,7 +396,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-X no-data-for-failed-tables</></term> <term><option>--no-data-for-failed-tables</></term>
<listitem> <listitem>
<para> <para>
By default, table data objects are restored even if the By default, table data objects are restored even if the
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.464 2006/10/07 03:32:28 momjian Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.465 2006/10/07 20:59:03 petere Exp $ -->
<!-- <!--
Typical markup: Typical markup:
...@@ -1815,7 +1815,7 @@ For new features, add links to the documentation sections. ...@@ -1815,7 +1815,7 @@ For new features, add links to the documentation sections.
<listitem> <listitem>
<para> <para>
Add <link linkend="APP-PGRESTORE"><application>pg_restore</></link> Add <link linkend="APP-PGRESTORE"><application>pg_restore</></link>
<literal>-X no-data-for-failed-tables</> option to suppress <literal>--no-data-for-failed-tables</> option to suppress
loading data if table creation failed (the table already loading data if table creation failed (the table already
exists) (Martin Pitt) exists) (Martin Pitt)
</para> </para>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* by PostgreSQL * by PostgreSQL
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.451 2006/10/06 17:14:00 petere Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.452 2006/10/07 20:59:04 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -256,8 +256,7 @@ main(int argc, char **argv) ...@@ -256,8 +256,7 @@ main(int argc, char **argv)
{"version", no_argument, NULL, 'V'}, {"version", no_argument, NULL, 'V'},
/* /*
* the following options don't have an equivalent short option letter, * the following options don't have an equivalent short option letter
* but are available as '-X long-name'
*/ */
{"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1}, {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1},
{"disable-triggers", no_argument, &disable_triggers, 1}, {"disable-triggers", no_argument, &disable_triggers, 1},
...@@ -432,14 +431,8 @@ main(int argc, char **argv) ...@@ -432,14 +431,8 @@ main(int argc, char **argv)
aclsSkip = true; aclsSkip = true;
break; break;
/*
* Option letters were getting scarce, so I invented this new
* scheme: '-X feature' turns on some feature. Compare to the
* -f option in GCC. You should also add an equivalent
* GNU-style option --feature. Features that require
* arguments should use '-X feature=foo'.
*/
case 'X': case 'X':
/* -X is a deprecated alternative to long options */
if (strcmp(optarg, "disable-dollar-quoting") == 0) if (strcmp(optarg, "disable-dollar-quoting") == 0)
disable_dollar_quoting = 1; disable_dollar_quoting = 1;
else if (strcmp(optarg, "disable-triggers") == 0) else if (strcmp(optarg, "disable-triggers") == 0)
...@@ -459,9 +452,9 @@ main(int argc, char **argv) ...@@ -459,9 +452,9 @@ main(int argc, char **argv)
case 'Z': /* Compression Level */ case 'Z': /* Compression Level */
compressLevel = atoi(optarg); compressLevel = atoi(optarg);
break; break;
/* This covers the long options equivalent to -X xxx. */
case 0: case 0:
/* This covers the long options equivalent to -X xxx. */
break; break;
default: default:
...@@ -908,11 +901,9 @@ help(const char *progname) ...@@ -908,11 +901,9 @@ help(const char *progname)
printf(_(" -t, --table=TABLE dump the named table only\n")); printf(_(" -t, --table=TABLE dump the named table only\n"));
printf(_(" -T, --exclude-table=TABLE do NOT dump the named table\n")); printf(_(" -T, --exclude-table=TABLE do NOT dump the named table\n"));
printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n")); printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
printf(_(" -X disable-dollar-quoting, --disable-dollar-quoting\n" printf(_(" --disable-dollar-quoting disable dollar quoting, use SQL standard quoting\n"));
" disable dollar quoting, use SQL standard quoting\n")); printf(_(" --disable-triggers disable triggers during data-only restore\n"));
printf(_(" -X disable-triggers, --disable-triggers\n" printf(_(" --use-set-session-authorization\n"
" disable triggers during data-only restore\n"));
printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
" use SESSION AUTHORIZATION commands instead of\n" " use SESSION AUTHORIZATION commands instead of\n"
" OWNER TO commands\n")); " OWNER TO commands\n"));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* *
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.83 2006/10/04 00:30:05 momjian Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.84 2006/10/07 20:59:05 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -63,7 +63,6 @@ static bool skip_acls = false; ...@@ -63,7 +63,6 @@ static bool skip_acls = false;
static bool verbose = false; static bool verbose = false;
static bool ignoreVersion = false; static bool ignoreVersion = false;
/* flags for -X long options */
static int disable_dollar_quoting = 0; static int disable_dollar_quoting = 0;
static int disable_triggers = 0; static int disable_triggers = 0;
static int use_setsessauth = 0; static int use_setsessauth = 0;
...@@ -107,8 +106,7 @@ main(int argc, char *argv[]) ...@@ -107,8 +106,7 @@ main(int argc, char *argv[])
{"no-acl", no_argument, NULL, 'x'}, {"no-acl", no_argument, NULL, 'x'},
/* /*
* the following options don't have an equivalent short option letter, * the following options don't have an equivalent short option letter
* but are available as '-X long-name'
*/ */
{"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1}, {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1},
{"disable-triggers", no_argument, &disable_triggers, 1}, {"disable-triggers", no_argument, &disable_triggers, 1},
...@@ -255,10 +253,11 @@ main(int argc, char *argv[]) ...@@ -255,10 +253,11 @@ main(int argc, char *argv[])
break; break;
case 'X': case 'X':
/* -X is a deprecated alternative to long options */
if (strcmp(optarg, "disable-dollar-quoting") == 0) if (strcmp(optarg, "disable-dollar-quoting") == 0)
appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting"); appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting");
else if (strcmp(optarg, "disable-triggers") == 0) else if (strcmp(optarg, "disable-triggers") == 0)
appendPQExpBuffer(pgdumpopts, " -X disable-triggers"); appendPQExpBuffer(pgdumpopts, " --disable-triggers");
else if (strcmp(optarg, "use-set-session-authorization") == 0) else if (strcmp(optarg, "use-set-session-authorization") == 0)
/* no-op, still allowed for compatibility */ ; /* no-op, still allowed for compatibility */ ;
else else
...@@ -282,11 +281,11 @@ main(int argc, char *argv[]) ...@@ -282,11 +281,11 @@ main(int argc, char *argv[])
/* Add long options to the pg_dump argument list */ /* Add long options to the pg_dump argument list */
if (disable_dollar_quoting) if (disable_dollar_quoting)
appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting"); appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting");
if (disable_triggers) if (disable_triggers)
appendPQExpBuffer(pgdumpopts, " -X disable-triggers"); appendPQExpBuffer(pgdumpopts, " --disable-triggers");
if (use_setsessauth) if (use_setsessauth)
appendPQExpBuffer(pgdumpopts, " -X use-set-session-authorization"); appendPQExpBuffer(pgdumpopts, " --use-set-session-authorization");
if (optind < argc) if (optind < argc)
{ {
...@@ -388,11 +387,10 @@ help(void) ...@@ -388,11 +387,10 @@ help(void)
printf(_(" -s, --schema-only dump only the schema, no data\n")); printf(_(" -s, --schema-only dump only the schema, no data\n"));
printf(_(" -S, --superuser=NAME specify the superuser user name to use in the dump\n")); printf(_(" -S, --superuser=NAME specify the superuser user name to use in the dump\n"));
printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n")); printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
printf(_(" -X disable-dollar-quoting, --disable-dollar-quoting\n" printf(_(" --disable-dollar-quoting\n"
" disable dollar quoting, use SQL standard quoting\n")); " disable dollar quoting, use SQL standard quoting\n"));
printf(_(" -X disable-triggers, --disable-triggers\n" printf(_(" --disable-triggers disable triggers during data-only restore\n"));
" disable triggers during data-only restore\n")); printf(_(" --use-set-session-authorization\n"
printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
" use SESSION AUTHORIZATION commands instead of\n" " use SESSION AUTHORIZATION commands instead of\n"
" OWNER TO commands\n")); " OWNER TO commands\n"));
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.82 2006/10/06 17:14:00 petere Exp $ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.83 2006/10/07 20:59:05 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -76,6 +76,7 @@ main(int argc, char **argv) ...@@ -76,6 +76,7 @@ main(int argc, char **argv)
extern char *optarg; extern char *optarg;
static int use_setsessauth = 0; static int use_setsessauth = 0;
static int disable_triggers = 0; static int disable_triggers = 0;
static int no_data_for_failed_tables = 0;
struct option cmdopts[] = { struct option cmdopts[] = {
{"clean", 0, NULL, 'c'}, {"clean", 0, NULL, 'c'},
...@@ -107,11 +108,11 @@ main(int argc, char **argv) ...@@ -107,11 +108,11 @@ main(int argc, char **argv)
{"single-transaction", 0, NULL, '1'}, {"single-transaction", 0, NULL, '1'},
/* /*
* the following options don't have an equivalent short option letter, * the following options don't have an equivalent short option letter
* but are available as '-X long-name'
*/ */
{"use-set-session-authorization", no_argument, &use_setsessauth, 1}, {"use-set-session-authorization", no_argument, &use_setsessauth, 1},
{"disable-triggers", no_argument, &disable_triggers, 1}, {"disable-triggers", no_argument, &disable_triggers, 1},
{"no-data-for-failed-tables", no_argument, &no_data_for_failed_tables, 1},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
...@@ -244,12 +245,11 @@ main(int argc, char **argv) ...@@ -244,12 +245,11 @@ main(int argc, char **argv)
break; break;
case 'X': case 'X':
/* -X is a deprecated alternative to long options */
if (strcmp(optarg, "use-set-session-authorization") == 0) if (strcmp(optarg, "use-set-session-authorization") == 0)
use_setsessauth = 1; use_setsessauth = 1;
else if (strcmp(optarg, "disable-triggers") == 0) else if (strcmp(optarg, "disable-triggers") == 0)
disable_triggers = 1; disable_triggers = 1;
else if (strcmp(optarg, "no-data-for-failed-tables") == 0)
opts->noDataForFailedTables = 1;
else else
{ {
fprintf(stderr, fprintf(stderr,
...@@ -260,8 +260,8 @@ main(int argc, char **argv) ...@@ -260,8 +260,8 @@ main(int argc, char **argv)
} }
break; break;
/* This covers the long options equivalent to -X xxx. */
case 0: case 0:
/* This covers the long options equivalent to -X xxx. */
break; break;
case '1': /* Restore data in a single transaction */ case '1': /* Restore data in a single transaction */
...@@ -296,6 +296,7 @@ main(int argc, char **argv) ...@@ -296,6 +296,7 @@ main(int argc, char **argv)
opts->disable_triggers = disable_triggers; opts->disable_triggers = disable_triggers;
opts->use_setsessauth = use_setsessauth; opts->use_setsessauth = use_setsessauth;
opts->noDataForFailedTables = no_data_for_failed_tables;
if (opts->formatName) if (opts->formatName)
{ {
...@@ -390,12 +391,11 @@ usage(const char *progname) ...@@ -390,12 +391,11 @@ usage(const char *progname)
printf(_(" -t, --table=NAME restore named table\n")); printf(_(" -t, --table=NAME restore named table\n"));
printf(_(" -T, --trigger=NAME restore named trigger\n")); printf(_(" -T, --trigger=NAME restore named trigger\n"));
printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n")); printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
printf(_(" -X disable-triggers, --disable-triggers\n" printf(_(" --disable-triggers disable triggers during data-only restore\n"));
" disable triggers during data-only restore\n")); printf(_(" --use-set-session-authorization\n"
printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
" use SESSION AUTHORIZATION commands instead of\n" " use SESSION AUTHORIZATION commands instead of\n"
" OWNER TO commands\n")); " OWNER TO commands\n"));
printf(_(" -X no-data-for-failed-tables\n" printf(_(" --no-data-for-failed-tables\n"
" do not restore data of tables that could not be\n" " do not restore data of tables that could not be\n"
" created\n")); " created\n"));
printf(_(" -1, --single-transaction\n" printf(_(" -1, --single-transaction\n"
......
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