Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 30ab5bd

Browse files
committed
More message munging and localization for pg_dump, especially the
--verbose messages, which had not been considered so far. Output to the terminal should okay now; comments written into the dump are still English only, which may or may not be the desirable thing.
1 parent 3ec9fb8 commit 30ab5bd

13 files changed

+852
-490
lines changed

src/bin/pg_dump/common.c

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.56 2001/06/27 21:21:36 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.57 2001/07/03 20:21:47 petere Exp $
1212
*
1313
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1414
*
@@ -179,7 +179,7 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
179179
inhinfo[i].inhparent,
180180
oid);
181181

182-
exit(2);
182+
exit_nicely();
183183
}
184184
(**parentIndexes)[j] = parentInd;
185185
result[j++] = tblinfo[parentInd].relname;
@@ -219,7 +219,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
219219
if (argNum >= arraysize)
220220
{
221221
write_msg(NULL, "parseNumericArray: too many numbers\n");
222-
exit(2);
222+
exit_nicely();
223223
}
224224
temp[j] = '\0';
225225
array[argNum++] = strdup(temp);
@@ -234,7 +234,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
234234
j >= sizeof(temp) - 1)
235235
{
236236
write_msg(NULL, "parseNumericArray: bogus number\n");
237-
exit(2);
237+
exit_nicely();
238238
}
239239
temp[j++] = s;
240240
}
@@ -297,110 +297,93 @@ dumpSchema(Archive *fout,
297297
IndInfo *indinfo = NULL;
298298

299299
if (g_verbose)
300-
fprintf(stderr, "%s reading user-defined types %s\n",
301-
g_comment_start, g_comment_end);
300+
write_msg(NULL, "reading user-defined types\n");
302301
tinfo = getTypes(&numTypes);
303302

304303
if (g_verbose)
305-
fprintf(stderr, "%s reading user-defined functions %s\n",
306-
g_comment_start, g_comment_end);
304+
write_msg(NULL, "reading user-defined functions\n");
307305
finfo = getFuncs(&numFuncs);
308306

309307
if (g_verbose)
310-
fprintf(stderr, "%s reading user-defined aggregates %s\n",
311-
g_comment_start, g_comment_end);
308+
write_msg(NULL, "reading user-defined aggregate functions\n");
312309
agginfo = getAggregates(&numAggregates);
313310

314311
if (g_verbose)
315-
fprintf(stderr, "%s reading user-defined operators %s\n",
316-
g_comment_start, g_comment_end);
312+
write_msg(NULL, "reading user-defined operators\n");
317313
oprinfo = getOperators(&numOperators);
318314

319315
if (g_verbose)
320-
fprintf(stderr, "%s reading user-defined tables %s\n",
321-
g_comment_start, g_comment_end);
316+
write_msg(NULL, "reading user-defined tables\n");
322317
tblinfo = getTables(&numTables, finfo, numFuncs);
323318

324319
if (g_verbose)
325-
fprintf(stderr, "%s reading indexes information %s\n",
326-
g_comment_start, g_comment_end);
320+
write_msg(NULL, "reading index information\n");
327321
indinfo = getIndexes(&numIndexes);
328322

329323
if (g_verbose)
330-
fprintf(stderr, "%s reading table inheritance information %s\n",
331-
g_comment_start, g_comment_end);
324+
write_msg(NULL, "reading table inheritance information\n");
332325
inhinfo = getInherits(&numInherits);
333326

334327
if (g_verbose)
335-
fprintf(stderr, "%s finding the attribute names and types for each table %s\n",
336-
g_comment_start, g_comment_end);
328+
write_msg(NULL, "finding the column names and types for each table\n");
337329
getTableAttrs(tblinfo, numTables);
338330

339331
if (g_verbose)
340-
fprintf(stderr, "%s flagging inherited attributes in subtables %s\n",
341-
g_comment_start, g_comment_end);
332+
write_msg(NULL, "flagging inherited columns in subtables\n");
342333
flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);
343334

344335
if (!tablename && !dataOnly)
345336
{
346337
if (g_verbose)
347-
fprintf(stderr, "%s dumping out database comment %s\n",
348-
g_comment_start, g_comment_end);
338+
write_msg(NULL, "dumping out database comment\n");
349339
dumpDBComment(fout);
350340
}
351341

352342
if (!tablename && fout)
353343
{
354344
if (g_verbose)
355-
fprintf(stderr, "%s dumping out user-defined types %s\n",
356-
g_comment_start, g_comment_end);
345+
write_msg(NULL, "dumping out user-defined types\n");
357346
dumpTypes(fout, finfo, numFuncs, tinfo, numTypes);
358347
}
359348

360349
if (g_verbose)
361-
fprintf(stderr, "%s dumping out tables %s\n",
362-
g_comment_start, g_comment_end);
350+
write_msg(NULL, "dumping out tables\n");
363351

364352
dumpTables(fout, tblinfo, numTables, indinfo, numIndexes, inhinfo, numInherits,
365353
tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly);
366354

367355
if (fout && !dataOnly)
368356
{
369357
if (g_verbose)
370-
fprintf(stderr, "%s dumping out indexes %s\n",
371-
g_comment_start, g_comment_end);
358+
write_msg(NULL, "dumping out indexes\n");
372359
dumpIndexes(fout, indinfo, numIndexes, tblinfo, numTables, tablename);
373360
}
374361

375362
if (!tablename && !dataOnly)
376363
{
377364
if (g_verbose)
378-
fprintf(stderr, "%s dumping out user-defined procedural languages %s\n",
379-
g_comment_start, g_comment_end);
365+
write_msg(NULL, "dumping out user-defined procedural languages\n");
380366
dumpProcLangs(fout, finfo, numFuncs, tinfo, numTypes);
381367
}
382368

383369
if (!tablename && !dataOnly)
384370
{
385371
if (g_verbose)
386-
fprintf(stderr, "%s dumping out user-defined functions %s\n",
387-
g_comment_start, g_comment_end);
372+
write_msg(NULL, "dumping out user-defined functions\n");
388373
dumpFuncs(fout, finfo, numFuncs, tinfo, numTypes);
389374
}
390375

391376
if (!tablename && !dataOnly)
392377
{
393378
if (g_verbose)
394-
fprintf(stderr, "%s dumping out user-defined aggregates %s\n",
395-
g_comment_start, g_comment_end);
379+
write_msg(NULL, "dumping out user-defined aggregate functions\n");
396380
dumpAggs(fout, agginfo, numAggregates, tinfo, numTypes);
397381
}
398382

399383
if (!tablename && !dataOnly)
400384
{
401385
if (g_verbose)
402-
fprintf(stderr, "%s dumping out user-defined operators %s\n",
403-
g_comment_start, g_comment_end);
386+
write_msg(NULL, "dumping out user-defined operators\n");
404387
dumpOprs(fout, oprinfo, numOperators, tinfo, numTypes);
405388
}
406389

@@ -490,7 +473,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
490473
/* shouldn't happen unless findParentsByOid is broken */
491474
write_msg(NULL, "failed sanity check, table \"%s\" not found by flagInhAttrs\n",
492475
tblinfo[i].parentRels[k]);
493-
exit(2);
476+
exit_nicely();
494477
};
495478

496479
inhAttrInd = strInArray(tblinfo[i].attnames[j],

0 commit comments

Comments
 (0)