55 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
66 * Portions Copyright (c) 1994, Regents of the University of California
77 *
8- * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.22 2009/01/01 17:23 :55 momjian Exp $
8+ * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.23 2009/02/18 12:11 :55 momjian Exp $
99 *
1010 *-------------------------------------------------------------------------
1111 */
1515
1616
1717static void vacuum_one_database (const char * dbname , bool full , bool verbose , bool analyze ,
18- const char * table ,
18+ bool freeze , const char * table ,
1919 const char * host , const char * port ,
2020 const char * username , bool password ,
2121 const char * progname , bool echo );
22- static void vacuum_all_databases (bool full , bool verbose , bool analyze ,
22+ static void vacuum_all_databases (bool full , bool verbose , bool analyze , bool freeze ,
2323 const char * host , const char * port ,
2424 const char * username , bool password ,
2525 const char * progname , bool echo , bool quiet );
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
3939 {"quiet" , no_argument , NULL , 'q' },
4040 {"dbname" , required_argument , NULL , 'd' },
4141 {"analyze" , no_argument , NULL , 'z' },
42+ {"freeze" , no_argument , NULL , 'F' },
4243 {"all" , no_argument , NULL , 'a' },
4344 {"table" , required_argument , NULL , 't' },
4445 {"full" , no_argument , NULL , 'f' },
@@ -58,6 +59,7 @@ main(int argc, char *argv[])
5859 bool echo = false;
5960 bool quiet = false;
6061 bool analyze = false;
62+ bool freeze = false;
6163 bool alldb = false;
6264 char * table = NULL ;
6365 bool full = false;
@@ -68,7 +70,7 @@ main(int argc, char *argv[])
6870
6971 handle_help_version_opts (argc , argv , "vacuumdb" , help );
7072
71- while ((c = getopt_long (argc , argv , "h:p:U:Weqd:zat :fv" , long_options , & optindex )) != -1 )
73+ while ((c = getopt_long (argc , argv , "h:p:U:Weqd:zaFt :fv" , long_options , & optindex )) != -1 )
7274 {
7375 switch (c )
7476 {
@@ -96,6 +98,9 @@ main(int argc, char *argv[])
9698 case 'z' :
9799 analyze = true;
98100 break ;
101+ case 'F' :
102+ freeze = true;
103+ break ;
99104 case 'a' :
100105 alldb = true;
101106 break ;
@@ -145,7 +150,7 @@ main(int argc, char *argv[])
145150 exit (1 );
146151 }
147152
148- vacuum_all_databases (full , verbose , analyze ,
153+ vacuum_all_databases (full , verbose , analyze , freeze ,
149154 host , port , username , password ,
150155 progname , echo , quiet );
151156 }
@@ -161,7 +166,7 @@ main(int argc, char *argv[])
161166 dbname = get_user_name (progname );
162167 }
163168
164- vacuum_one_database (dbname , full , verbose , analyze , table ,
169+ vacuum_one_database (dbname , full , verbose , analyze , freeze , table ,
165170 host , port , username , password ,
166171 progname , echo );
167172 }
@@ -172,7 +177,7 @@ main(int argc, char *argv[])
172177
173178static void
174179vacuum_one_database (const char * dbname , bool full , bool verbose , bool analyze ,
175- const char * table ,
180+ bool freeze , const char * table ,
176181 const char * host , const char * port ,
177182 const char * username , bool password ,
178183 const char * progname , bool echo )
@@ -190,6 +195,8 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
190195 appendPQExpBuffer (& sql , " VERBOSE" );
191196 if (analyze )
192197 appendPQExpBuffer (& sql , " ANALYZE" );
198+ if (freeze )
199+ appendPQExpBuffer (& sql , " FREEZE" );
193200 if (table )
194201 appendPQExpBuffer (& sql , " %s" , table );
195202 appendPQExpBuffer (& sql , ";\n" );
@@ -212,7 +219,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
212219
213220
214221static void
215- vacuum_all_databases (bool full , bool verbose , bool analyze ,
222+ vacuum_all_databases (bool full , bool verbose , bool analyze , bool freeze ,
216223 const char * host , const char * port ,
217224 const char * username , bool password ,
218225 const char * progname , bool echo , bool quiet )
@@ -235,7 +242,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze,
235242 fflush (stdout );
236243 }
237244
238- vacuum_one_database (dbname , full , verbose , analyze , NULL ,
245+ vacuum_one_database (dbname , full , verbose , analyze , freeze , NULL ,
239246 host , port , username , password ,
240247 progname , echo );
241248 }
@@ -256,6 +263,7 @@ help(const char *progname)
256263 printf (_ (" -t, --table='TABLE[(COLUMNS)]' vacuum specific table only\n" ));
257264 printf (_ (" -f, --full do full vacuuming\n" ));
258265 printf (_ (" -z, --analyze update optimizer hints\n" ));
266+ printf (_ (" -F, --freeze freeze row transaction information\n" ));
259267 printf (_ (" -e, --echo show the commands being sent to the server\n" ));
260268 printf (_ (" -q, --quiet don't write any messages\n" ));
261269 printf (_ (" -v, --verbose write a lot of output\n" ));
0 commit comments