I would like to add a --freeze parameter to vacuumdb for use by the
binary upgrade utility, and for symmetry with the existing VACUUM
options;  patch attached.

I could also accomplish with with PGOPTIONs but this seem like a cleaner
solution.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/ref/vacuumdb.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v
retrieving revision 1.42
diff -c -c -r1.42 vacuumdb.sgml
*** doc/src/sgml/ref/vacuumdb.sgml      11 Dec 2007 19:57:32 -0000      1.42
--- doc/src/sgml/ref/vacuumdb.sgml      17 Feb 2009 16:24:39 -0000
***************
*** 26,31 ****
--- 26,32 ----
     <group><arg>--full</arg><arg>-f</arg></group>
     <group><arg>--verbose</arg><arg>-v</arg></group>
     <group><arg>--analyze</arg><arg>-z</arg></group>
+    <group><arg>--freeze</arg><arg>-F</arg></group>
     <arg>--table | -t <replaceable>table</replaceable>
      <arg>( <replaceable class="parameter">column</replaceable> [,...] )</arg>
     </arg>
***************
*** 37,42 ****
--- 38,44 ----
     <group><arg>--full</arg><arg>-f</arg></group>
     <group><arg>--verbose</arg><arg>-v</arg></group>
     <group><arg>--analyze</arg><arg>-z</arg></group>
+    <group><arg>--freeze</arg><arg>-F</arg></group>
    </cmdsynopsis>
   </refsynopsisdiv>
   
***************
*** 161,166 ****
--- 163,178 ----
         </para>
        </listitem>
       </varlistentry>
+ 
+      <varlistentry>
+       <term><option>-F</option></term>
+       <term><option>--freeze</option></term>
+       <listitem>
+        <para>
+         Aggressively <quote>freeze</quote> tuples.
+        </para>
+       </listitem>
+      </varlistentry>
      </variablelist>
     </para>
  
Index: src/bin/scripts/vacuumdb.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/scripts/vacuumdb.c,v
retrieving revision 1.22
diff -c -c -r1.22 vacuumdb.c
*** src/bin/scripts/vacuumdb.c  1 Jan 2009 17:23:55 -0000       1.22
--- src/bin/scripts/vacuumdb.c  17 Feb 2009 16:24:39 -0000
***************
*** 15,25 ****
  
  
  static void vacuum_one_database(const char *dbname, bool full, bool verbose, 
bool analyze,
!                                       const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo);
! static void vacuum_all_databases(bool full, bool verbose, bool analyze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool 
quiet);
--- 15,25 ----
  
  
  static void vacuum_one_database(const char *dbname, bool full, bool verbose, 
bool analyze,
!                                       bool freeze, const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo);
! static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool 
freeze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool 
quiet);
***************
*** 39,44 ****
--- 39,45 ----
                {"quiet", no_argument, NULL, 'q'},
                {"dbname", required_argument, NULL, 'd'},
                {"analyze", no_argument, NULL, 'z'},
+               {"freeze", no_argument, NULL, 'F'},
                {"all", no_argument, NULL, 'a'},
                {"table", required_argument, NULL, 't'},
                {"full", no_argument, NULL, 'f'},
***************
*** 58,63 ****
--- 59,65 ----
        bool            echo = false;
        bool            quiet = false;
        bool            analyze = false;
+       bool            freeze = false;
        bool            alldb = false;
        char       *table = NULL;
        bool            full = false;
***************
*** 68,74 ****
  
        handle_help_version_opts(argc, argv, "vacuumdb", help);
  
!       while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zat:fv", long_options, 
&optindex)) != -1)
        {
                switch (c)
                {
--- 70,76 ----
  
        handle_help_version_opts(argc, argv, "vacuumdb", help);
  
!       while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zaFt:fv", long_options, 
&optindex)) != -1)
        {
                switch (c)
                {
***************
*** 96,101 ****
--- 98,106 ----
                        case 'z':
                                analyze = true;
                                break;
+                       case 'F':
+                               freeze = true;
+                               break;
                        case 'a':
                                alldb = true;
                                break;
***************
*** 145,151 ****
                        exit(1);
                }
  
!               vacuum_all_databases(full, verbose, analyze,
                                                         host, port, username, 
password,
                                                         progname, echo, quiet);
        }
--- 150,156 ----
                        exit(1);
                }
  
!               vacuum_all_databases(full, verbose, analyze, freeze,
                                                         host, port, username, 
password,
                                                         progname, echo, quiet);
        }
***************
*** 161,167 ****
                                dbname = get_user_name(progname);
                }
  
!               vacuum_one_database(dbname, full, verbose, analyze, table,
                                                        host, port, username, 
password,
                                                        progname, echo);
        }
--- 166,172 ----
                                dbname = get_user_name(progname);
                }
  
!               vacuum_one_database(dbname, full, verbose, analyze, freeze, 
table,
                                                        host, port, username, 
password,
                                                        progname, echo);
        }
***************
*** 172,178 ****
  
  static void
  vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
!                                       const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo)
--- 177,183 ----
  
  static void
  vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
!                                       bool freeze, const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo)
***************
*** 190,195 ****
--- 195,202 ----
                appendPQExpBuffer(&sql, " VERBOSE");
        if (analyze)
                appendPQExpBuffer(&sql, " ANALYZE");
+       if (freeze)
+               appendPQExpBuffer(&sql, " FREEZE");
        if (table)
                appendPQExpBuffer(&sql, " %s", table);
        appendPQExpBuffer(&sql, ";\n");
***************
*** 212,218 ****
  
  
  static void
! vacuum_all_databases(bool full, bool verbose, bool analyze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool 
quiet)
--- 219,225 ----
  
  
  static void
! vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool 
quiet)
***************
*** 235,241 ****
                        fflush(stdout);
                }
  
!               vacuum_one_database(dbname, full, verbose, analyze, NULL,
                                                        host, port, username, 
password,
                                                        progname, echo);
        }
--- 242,248 ----
                        fflush(stdout);
                }
  
!               vacuum_one_database(dbname, full, verbose, analyze, freeze, 
NULL,
                                                        host, port, username, 
password,
                                                        progname, echo);
        }
***************
*** 256,261 ****
--- 263,269 ----
        printf(_("  -t, --table='TABLE[(COLUMNS)]'  vacuum specific table 
only\n"));
        printf(_("  -f, --full                      do full vacuuming\n"));
        printf(_("  -z, --analyze                   update optimizer hints\n"));
+       printf(_("  -F, --freeze                    freeze row transaction 
information\n"));
        printf(_("  -e, --echo                      show the commands being 
sent to the server\n"));
        printf(_("  -q, --quiet                     don't write any 
messages\n"));
        printf(_("  -v, --verbose                   write a lot of output\n"));
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to