Fixup pg_dumpall adding --lock-wait-timeout, to match pg_dump.
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 29 Aug 2008 17:28:43 +0000 (17:28 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 29 Aug 2008 17:28:43 +0000 (17:28 +0000)
David Gould

doc/src/sgml/ref/pg_dumpall.sgml
src/bin/pg_dump/pg_dumpall.c

index d00da825663addd8afd60f91551eb2a075c62b0c..ec40890ad32b97e5ecc9994c74817ad03b14f88b 100644 (file)
@@ -195,6 +195,22 @@ PostgreSQL documentation
       </listitem>
      </varlistentry>
 
+     <varlistentry>
+      <term><option>--lock-wait-timeout=<replaceable class="parameter">timeout</replaceable></option></term>
+      <listitem>
+       <para>
+        Do not wait forever to acquire shared table locks at the beginning of
+        the dump. Instead fail if unable to lock a table within the specified
+        <replaceable class="parameter">timeout</>. The timeout may be
+        specified in any of the formats accepted by <command>SET
+        statement_timeout</>.  (Allowed values vary depending on the server
+        version you are dumping from, but an integer number of milliseconds
+        is accepted by all versions since 7.3.  This option is ignored when
+        dumping from a pre-7.3 server.)
+       </para>
+      </listitem>
+     </varlistentry>
+
      <varlistentry>
       <term><option>--no-tablespaces</option></term>
       <listitem>
index 93597a70593026cc115b838dc68ed66b9a3bc88e..fa51af0f3cef9e4e101edf0ff944405f4077961b 100644 (file)
@@ -120,6 +120,7 @@ main(int argc, char *argv[])
                {"disable-triggers", no_argument, &disable_triggers, 1},
                {"no-tablespaces", no_argument, &no_tablespaces, 1},
                {"use-set-session-authorization", no_argument, &use_setsessauth, 1},
+               {"lock-wait-timeout", required_argument, NULL, 2},
 
                {NULL, 0, NULL, 0}
        };
@@ -305,6 +306,11 @@ main(int argc, char *argv[])
                        case 0:
                                break;
 
+                       case 2:
+                               appendPQExpBuffer(pgdumpopts, " --lock-wait-timeout=");
+                               appendPQExpBuffer(pgdumpopts, optarg);
+                               break;
+
                        default:
                                fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
                                exit(1);
@@ -488,6 +494,8 @@ help(void)
        printf(_("  -f, --file=FILENAME      output file name\n"));
        printf(_("  --help                   show this help, then exit\n"));
        printf(_("  --version                output version information, then exit\n"));
+       printf(_("  --lock-wait-timeout=TIMEOUT\n"
+                        "                           fail after waiting TIMEOUT for a table lock\n"));
        printf(_("\nOptions controlling the output content:\n"));
        printf(_("  -a, --data-only          dump only the data, not the schema\n"));
        printf(_("  -c, --clean              clean (drop) databases prior to create\n"));