5
5
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
6
6
* Portions Copyright (c) 1994, Regents of the University of California
7
7
*
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 $
9
9
*
10
10
*-------------------------------------------------------------------------
11
11
*/
15
15
16
16
17
17
static void vacuum_one_database (const char * dbname , bool full , bool verbose , bool analyze ,
18
- const char * table ,
18
+ bool freeze , const char * table ,
19
19
const char * host , const char * port ,
20
20
const char * username , bool password ,
21
21
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 ,
23
23
const char * host , const char * port ,
24
24
const char * username , bool password ,
25
25
const char * progname , bool echo , bool quiet );
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
39
39
{"quiet" , no_argument , NULL , 'q' },
40
40
{"dbname" , required_argument , NULL , 'd' },
41
41
{"analyze" , no_argument , NULL , 'z' },
42
+ {"freeze" , no_argument , NULL , 'F' },
42
43
{"all" , no_argument , NULL , 'a' },
43
44
{"table" , required_argument , NULL , 't' },
44
45
{"full" , no_argument , NULL , 'f' },
@@ -58,6 +59,7 @@ main(int argc, char *argv[])
58
59
bool echo = false;
59
60
bool quiet = false;
60
61
bool analyze = false;
62
+ bool freeze = false;
61
63
bool alldb = false;
62
64
char * table = NULL ;
63
65
bool full = false;
@@ -68,7 +70,7 @@ main(int argc, char *argv[])
68
70
69
71
handle_help_version_opts (argc , argv , "vacuumdb" , help );
70
72
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 )
72
74
{
73
75
switch (c )
74
76
{
@@ -96,6 +98,9 @@ main(int argc, char *argv[])
96
98
case 'z' :
97
99
analyze = true;
98
100
break ;
101
+ case 'F' :
102
+ freeze = true;
103
+ break ;
99
104
case 'a' :
100
105
alldb = true;
101
106
break ;
@@ -145,7 +150,7 @@ main(int argc, char *argv[])
145
150
exit (1 );
146
151
}
147
152
148
- vacuum_all_databases (full , verbose , analyze ,
153
+ vacuum_all_databases (full , verbose , analyze , freeze ,
149
154
host , port , username , password ,
150
155
progname , echo , quiet );
151
156
}
@@ -161,7 +166,7 @@ main(int argc, char *argv[])
161
166
dbname = get_user_name (progname );
162
167
}
163
168
164
- vacuum_one_database (dbname , full , verbose , analyze , table ,
169
+ vacuum_one_database (dbname , full , verbose , analyze , freeze , table ,
165
170
host , port , username , password ,
166
171
progname , echo );
167
172
}
@@ -172,7 +177,7 @@ main(int argc, char *argv[])
172
177
173
178
static void
174
179
vacuum_one_database (const char * dbname , bool full , bool verbose , bool analyze ,
175
- const char * table ,
180
+ bool freeze , const char * table ,
176
181
const char * host , const char * port ,
177
182
const char * username , bool password ,
178
183
const char * progname , bool echo )
@@ -190,6 +195,8 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
190
195
appendPQExpBuffer (& sql , " VERBOSE" );
191
196
if (analyze )
192
197
appendPQExpBuffer (& sql , " ANALYZE" );
198
+ if (freeze )
199
+ appendPQExpBuffer (& sql , " FREEZE" );
193
200
if (table )
194
201
appendPQExpBuffer (& sql , " %s" , table );
195
202
appendPQExpBuffer (& sql , ";\n" );
@@ -212,7 +219,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
212
219
213
220
214
221
static void
215
- vacuum_all_databases (bool full , bool verbose , bool analyze ,
222
+ vacuum_all_databases (bool full , bool verbose , bool analyze , bool freeze ,
216
223
const char * host , const char * port ,
217
224
const char * username , bool password ,
218
225
const char * progname , bool echo , bool quiet )
@@ -235,7 +242,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze,
235
242
fflush (stdout );
236
243
}
237
244
238
- vacuum_one_database (dbname , full , verbose , analyze , NULL ,
245
+ vacuum_one_database (dbname , full , verbose , analyze , freeze , NULL ,
239
246
host , port , username , password ,
240
247
progname , echo );
241
248
}
@@ -256,6 +263,7 @@ help(const char *progname)
256
263
printf (_ (" -t, --table='TABLE[(COLUMNS)]' vacuum specific table only\n" ));
257
264
printf (_ (" -f, --full do full vacuuming\n" ));
258
265
printf (_ (" -z, --analyze update optimizer hints\n" ));
266
+ printf (_ (" -F, --freeze freeze row transaction information\n" ));
259
267
printf (_ (" -e, --echo show the commands being sent to the server\n" ));
260
268
printf (_ (" -q, --quiet don't write any messages\n" ));
261
269
printf (_ (" -v, --verbose write a lot of output\n" ));
0 commit comments