8000 The -X option in pg_dump was supposed to be a workaround for the lack of · postgrespro/postgres_cluster@2b25e11 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b25e11

Browse files
committed
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.
1 parent dc9142f commit 2b25e11

File tree

8 files changed

+36
-55
lines changed
  • 8 files changed

    +36
    -55
    lines changed

    doc/src/sgml/perform.sgml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,4 +1,4 @@
    1-
    <!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.58 2006/09/16 00:30:14 momjian Exp $ -->
    1+
    <!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.59 2006/10/07 20:59:03 petere Exp $ -->
    22

    33
    <chapter id="performance-tips">
    44
    <title>Performance Tips</title>
    @@ -926,7 +926,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
    926926
    <footnote>
    927927
    <para>
    928928
    You can get the effect of disabling foreign keys by using
    929-
    the <option>-X disable-triggers</> option &mdash; but realize that
    929+
    the <option>--disable-triggers</> option &mdash; but realize that
    930930
    that eliminates, rather than just postponing, foreign key
    931931
    validation, and so it is possible to insert bad data if you use it.
    932932
    </para>

    doc/src/sgml/ref/pg_dump.sgml

    Lines changed: 1 addition & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,5 +1,5 @@
    11
    <!--
    2-
    $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.88 2006/09/16 00:30:19 momjian Exp $
    2+
    $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.89 2006/10/07 20:59:04 petere Exp $
    33
    PostgreSQL documentation
    44
    -->
    55

    @@ -524,7 +524,6 @@ PostgreSQL documentation
    524524
    </varlistentry>
    525525

    526526
    <varlistentry>
    527-
    <term><option>-X disable-dollar-quoting</></term>
    528527
    <term><option>--disable-dollar-quoting</></term>
    529528
    <listitem>
    530529
    <para>
    @@ -535,7 +534,6 @@ PostgreSQL documentation
    535534
    </varlistentry>
    536535

    537536
    <varlistentry>
    538-
    <term><option>-X disable-triggers</></term>
    539537
    <term><option>--disable-triggers</></term>
    540538
    <listitem>
    541539
    <para>
    @@ -563,7 +561,6 @@ PostgreSQL documentation
    563561
    </varlistentry>
    564562

    565563
    <varlistentry>
    566-
    <term><option>-X use-set-session-authorization</></term>
    567564
    <term><option>--use-set-session-authorization</></term>
    568565
    <listitem>
    569566
    <para>

    doc/src/sgml/ref/pg_dumpall.sgml

    Lines changed: 1 addition & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,5 +1,5 @@
    11
    <!--
    2-
    $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.57 2006/09/16 00:30:19 momjian Exp $
    2+
    $PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.58 2006/10/07 20:59:04 petere Exp $
    33
    PostgreSQL documentation
    44
    -->
    55

    @@ -241,7 +241,6 @@ PostgreSQL documentation
    241241
    </varlistentry>
    242242

    243243
    <varlistentry>
    244-
    <term><option>-X disable-dollar-quoting</></term>
    245244
    <term><option>--disable-dollar-quoting</></term>
    246245
    <listitem>
    247246
    <para>
    @@ -252,7 +251,6 @@ PostgreSQL documentation
    252251
    </varlistentry>
    253252

    254253
    <varlistentry>
    255-
    <term><option>-X disable-triggers</></term>
    256254
    <term><option>--disable-triggers</></term>
    257255
    <listitem>
    258256
    <para>
    @@ -274,7 +272,6 @@ PostgreSQL documentation
    274272
    </varlistentry>
    275273

    276274
    <varlistentry>
    277-
    <term><option>-X use-set-session-authorization</></term>
    278275
    <term><option>--use-set-session-authorization</></term>
    279276
    <listitem>
    280277
    <para>

    doc/src/sgml/ref/pg_restore.sgml

    Lines changed: 2 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,4 +1,4 @@
    1-
    <!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.61 2006/09/16 00:30:19 momjian Exp $ -->
    1+
    <!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.62 2006/10/07 20:59:04 petere Exp $ -->
    22

    33
    <refentry id="APP-PGRESTORE">
    44
    <refmeta>
    @@ -361,7 +361,6 @@
    361361
    </varlistentry>
    362362

    363363
    <varlistentry>
    364-
    <term><option>-X disable-triggers</></term>
    365364
    <term><option>--disable-triggers</></term>
    366365
    <listitem>
    367366
    <para>
    @@ -384,7 +383,6 @@
    384383
    </varlistentry>
    385384

    386385
    <varlistentry>
    387-
    <term><option>-X use-set-session-authorization</option></term>
    388386
    <term><option>--use-set-session-authorization</option></term>
    389387
    <listitem>
    390388
    <para>
    @@ -398,7 +396,7 @@
    398396
    </varlistentry>
    399397

    400398
    <varlistentry>
    401-
    <term><option>-X no-data-for-failed-tables</></term>
    399+
    <term><option>--no-data-for-failed-tables</></term>
    402400
    <listitem>
    403401
    <para>
    404402
    By default, table data objects are restored even if the

    doc/src/sgml/release.sgml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,4 +1,4 @@
    1-
    <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.464 2006/10/07 03:32:28 momjian Exp $ -->
    1+
    <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.465 2006/10/07 20:59:03 petere Exp $ -->
    22
    <!--
    33

    44
    Typical markup:
    @@ -1815,7 +1815,7 @@ For new features, add links to the documentation sections.
    18151815
    <listitem>
    18161816
    <para>
    18171817
    Add <link linkend="APP-PGRESTORE"><application>pg_restore</></link>
    1818-
    <literal>-X no-data-for-failed-tables</> option to suppress
    1818+
    <literal>--no-data-for-failed-tables</> option to suppress
    18191819
    loading data if table creation failed (the table already
    18201820
    exists) (Martin Pitt)
    18211821
    </para>

    src/bin/pg_dump/pg_dump.c

    Lines changed: 7 additions & 16 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,7 +12,7 @@
    1212
    * by PostgreSQL
    1313
    *
    1414
    * IDENTIFICATION
    15-
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.451 2006/10/06 17:14:00 petere Exp $
    15+
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.452 2006/10/07 20:59:04 petere Exp $
    1616
    *
    1717
    *-------------------------------------------------------------------------
    1818
    */
    @@ -256,8 +256,7 @@ main(int argc, char **argv)
    256256
    {"version", no_argument, NULL, 'V'},
    257257

    258258
    /*
    259-
    * the following options don't have an equivalent short option letter,
    260-
    * but are available as '-X long-name'
    259+
    * the following options don't have an equivalent short option letter
    261260
    */
    262261
    {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1},
    263262
    {"disable-triggers", no_argument, &disable_triggers, 1},
    @@ -432,14 +431,8 @@ main(int argc, char **argv)
    432431
    aclsSkip = true;
    433432
    break;
    434433

    435-
    /*
    436-
    * Option letters were getting scarce, so I invented this new
    437-
    * scheme: '-X feature' turns on some feature. Compare to the
    438-
    * -f option in GCC. You should also add an equivalent
    439-
    * GNU-style option --feature. Features that require
    440-
    * arguments should use '-X feature=foo'.
    441-
    */
    442434
    case 'X':
    435+
    /* -X is a deprecated alternative to long options */
    443436
    if (strcmp(optarg, "disable-dollar-quoting") == 0)
    444437
    disable_dollar_quoting = 1;
    445438
    else if (strcmp(optarg, "disable-triggers") == 0)
    @@ -459,9 +452,9 @@ main(int argc, char **argv)
    459452
    case 'Z': /* Compression Level */
    460453
    compressLevel = atoi(optarg);
    461454
    break;
    462-
    /* This covers the long options equivalent to -X xxx. */
    463455

    464456
    case 0:
    457+
    /* This covers the long options equivalent to -X xxx. */
    465458
    break;
    466459

    467460
    default:
    @@ -908,11 +901,9 @@ help(const char *progname)
    908901
    printf(_(" -t, --table=TABLE dump the named table only\n"));
    909902
    printf(_(" -T, --exclude-table=TABLE do NOT dump the named table\n"));
    910903
    printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
    911-
    printf(_(" -X disable-dollar-quoting, --disable-dollar-quoting\n"
    912-
    " disable dollar quoting, use SQL standard quoting\n"));
    913-
    printf(_(" -X disable-triggers, --disable-triggers\n"
    914-
    " disable triggers during data-only restore\n"));
    915-
    printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
    904+
    printf(_(" --disable-dollar-quoting disable dollar quoting, use SQL standard quoting\n"));
    905+
    printf(_(" --disable-triggers disable triggers during data-only restore\n"));
    906+
    printf(_(" --use-set-session-authorization\n"
    916907
    " use SESSION AUTHORIZATION commands instead of\n"
    917908
    " OWNER TO commands\n"));
    918909

    src/bin/pg_dump/pg_dumpall.c

    Lines changed: 11 additions & 13 deletions
    Original file line numberDiff line numberDiff line change
    @@ -6,7 +6,7 @@
    66
    * Portions Copyright (c) 1994, Regents of the University of California
    77
    *
    88
    *
    9-
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.83 2006/10/04 00:30:05 momjian Exp $
    9+
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.84 2006/10/07 20:59:05 petere Exp $
    1010
    *
    1111
    *-------------------------------------------------------------------------
    1212
    */
    @@ -63,7 +63,6 @@ static bool skip_acls = false;
    6363
    static bool verbose = false;
    6464
    static bool ignoreVersion = false;
    6565

    66-
    /* flags for -X long options */
    6766
    static int disable_dollar_quoting = 0;
    6867
    static int disable_triggers = 0;
    6968
    static int use_setsessauth = 0;
    @@ -107,8 +106,7 @@ main(int argc, char *argv[])
    107106
    {"no-acl", no_argument, NULL, 'x'},
    108107

    109108
    /*
    110-
    * the following options don't have an equivalent short option letter,
    111-
    * but are available as '-X long-name'
    109+
    * the following options don't have an equivalent short option letter
    112110
    */
    113111
    {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1},
    114112
    {"disable-triggers", no_argument, &disable_triggers, 1},
    @@ -255,10 +253,11 @@ main(int argc, char *argv[])
    255253
    break;
    256254

    257255
    case 'X':
    256+
    /* -X is a deprecated alternative to long options */
    258257
    if (strcmp(optarg, "disable-dollar-quoting") == 0)
    259-
    appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting");
    258+
    appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting");
    260259
    else if (strcmp(optarg, "disable-triggers") == 0)
    261-
    appendPQExpBuffer(pgdumpopts, " -X disable-triggers");
    260+
    appendPQExpBuffer(pgdumpopts, " --disable-triggers");
    262261
    else if (strcmp(optarg, "use-set-session-authorization") == 0)
    263262
    /* no-op, still allowed for compatibility */ ;
    264263
    else
    @@ -282,11 +281,11 @@ main(int argc, char *argv[])
    282281

    283282
    /* Add long options to the pg_dump argument list */
    284283
    if (disable_dollar_quoting)
    285-
    appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting");
    284+
    appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting");
    286285
    if (disable_triggers)
    287-
    appendPQExpBuffer(pgdumpopts, " -X disable-triggers");
    286+
    appendPQExpBuffer(pgdumpopts, " --disable-triggers");
    288287
    if (use_setsessauth)
    289-
    appendPQExpBuffer(pgdumpopts, " -X use-set-session-authorization");
    288+
    appendPQExpBuffer(pgdumpopts, " --use-set-session-authorization");
    290289

    291290
    if (optind < argc)
    292291
    {
    @@ -388,11 +387,10 @@ help(void)
    388387
    printf(_(" -s, --schema-only dump only the schema, no data\n"));
    389388
    printf(_(" -S, --superuser=NAME specify the superuser user name to use in the dump\n"));
    390389
    printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
    391-
    printf(_(" -X disable-dollar-quoting, --disable-dollar-quoting\n"
    390+
    printf(_(" --disable-dollar-quoting\n"
    392391
    " disable dollar quoting, use SQL standard quoting\n"));
    393-
    printf(_(" -X disable-triggers, --disable-triggers\n"
    394-
    " disable triggers during data-only restore\n"));
    395-
    printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
    392+
    printf(_(" --disable-triggers disable triggers during data-only restore\n"));
    393+
    printf(_(" --use-set-session-authorization\n"
    396394
    " use SESSION AUTHORIZATION commands instead of\n"
    397395
    " OWNER TO commands\n"));
    398396

    src/bin/pg_dump/pg_restore.c

    Lines changed: 10 additions & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -34,7 +34,7 @@
    3434
    *
    3535
    *
    3636
    * IDENTIFICATION
    37-
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.82 2006/10/06 17:14:00 petere Exp $
    37+
    * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.83 2006/10/07 20:59:05 petere Exp $
    3838
    *
    3939
    *-------------------------------------------------------------------------
    4040
    */
    @@ -76,6 +76,7 @@ main(int argc, char **argv)
    7676
    extern char *optarg;
    7777
    static int use_setsessauth = 0;
    7878
    static int disable_triggers = 0;
    79+
    static int no_data_for_failed_tables = 0;
    7980

    8081
    struct option cmdopts[] = {
    8182
    {"clean", 0, NULL, 'c'},
    @@ -107,11 +108,11 @@ main(int argc, char **argv)
    107108
    {"single-transaction", 0, NULL, '1'},
    108109

    109110
    /*
    110-
    * the following options don't have an equivalent short option letter,
    111-
    * but are available as '-X long-name'
    111+
    * the following options don't have an equivalent short option letter
    112112
    */
    113113
    {"use-set-session-authorization", no_argument, &use_setsessauth, 1},
    114114
    {"disable-triggers", no_argument, &disable_triggers, 1},
    115+
    {"no-data-for-failed-tables", no_argument, &no_data_for_failed_tables, 1},
    115116

    116117
    {NULL, 0, NULL, 0}
    117118
    };
    @@ -244,12 +245,11 @@ main(int argc, char **argv)
    244245
    break;
    245246

    246247
    case 'X':
    248+
    /* -X is a deprecated alternative to long options */
    247249
    if (strcmp(optarg, "use-set-session-authorization") == 0)
    248250
    use_setsessauth = 1;
    249251
    else if (strcmp(optarg, "disable-triggers") == 0)
    250252
    disable_triggers = 1;
    251-
    else if (strcmp(optarg, "no-data-for-failed-tables") == 0)
    252-
    opts->noDataForFailedTables = 1;
    253253
    else
    254254
    {
    255255
    fprintf(stderr,
    @@ -260,8 +260,8 @@ main(int argc, char **argv)
    260260
    }
    261261
    break;
    262262

    263-
    /* This covers the long options equivalent to -X xxx. */
    264263
    case 0:
    264+
    /* This covers the long options equivalent to -X xxx. */
    265265
    break;
    266266

    267267
    case '1': /* Restore data in a single transaction */
    @@ -296,6 +296,7 @@ main(int argc, char **argv)
    296296

    297297
    opts->disable_triggers = disable_triggers;
    298298
    opts->use_setsessauth = use_setsessauth;
    299+
    opts->noDataForFailedTables = no_data_for_failed_tables;
    299300

    300301
    if (opts->formatName)
    301302
    {
    @@ -390,12 +391,11 @@ usage(const char *progname)
    390391
    printf(_(" -t, --table=NAME restore named table\n"));
    391392
    printf(_(" -T, --trigger=NAME restore named trigger\n"));
    392393
    printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
    393-
    printf(_(" -X disable-triggers, --disable-triggers\n"
    394-
    " disable triggers during data-only restore\n"));
    395-
    printf(_(" -X use-set-session-authorization, --use-set-session-authorization\n"
    394+
    printf(_(" --disable-triggers disable triggers during data-only restore\n"));
    395+
    printf(_(" --use-set-session-authorization\n"
    396396
    " use SESSION AUTHORIZATION commands instead of\n"
    397397
    " OWNER TO commands\n"));
    398-
    printf(_(" -X no-data-for-failed-tables\n"
    398+
    printf(_(" --no-data-for-failed-tables\n"
    399399
    " do not restore data of tables that could not be\n"
    400400
    " created\n"));
    401401
    printf(_(" -1, --single-transaction\n"

    0 commit comments

    Comments
     (0)
    0