*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.106 2005/03/18 17:32:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.107 2005/04/15 16:40:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static int _canRestoreBlobs(ArchiveHandle *AH);
static int _restoringToDB(ArchiveHandle *AH);
+static void dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim);
+
/*
* Wrapper functions.
RestoreArchive(Archive *AHX, RestoreOptions *ropt)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
- TocEntry *te = AH->toc->next;
+ TocEntry *te;
teReqs reqs;
OutputContext sav;
bool defnDumped;
ahprintf(AH, "--\n-- PostgreSQL database dump\n--\n\n");
+ if (AH->public.verbose)
+ dumpTimestamp(AH, "Started on", AH->createDate);
+
/*
* Establish important parameter values right away.
*/
*/
if (ropt->dropSchema)
{
- te = AH->toc->prev;
- AH->currentTE = te;
-
- while (te != AH->toc)
+ for (te = AH->toc->prev; te != AH->toc; te = te->prev)
{
+ AH->currentTE = te;
+
reqs = _tocEntryRequired(te, ropt, false /* needn't drop ACLs */);
if (((reqs & REQ_SCHEMA) != 0) && te->dropStmt)
{
/* Drop it */
ahprintf(AH, "%s", te->dropStmt);
}
- te = te->prev;
}
}
/*
* Now process each non-ACL TOC entry
*/
- te = AH->toc->next;
- while (te != AH->toc)
+ for (te = AH->toc->next; te != AH->toc; te = te->next)
{
AH->currentTE = te;
_printTocEntry(AH, te, ropt, false, false);
}
}
- te = te->next;
} /* end loop over TOC entries */
/*
* Scan TOC again to output ownership commands and ACLs
*/
- te = AH->toc->next;
- while (te != AH->toc)
+ for (te = AH->toc->next; te != AH->toc; te = te->next)
{
AH->currentTE = te;
te->desc, te->tag);
_printTocEntry(AH, te, ropt, false, true);
}
-
- te = te->next;
}
+ if (AH->public.verbose)
+ dumpTimestamp(AH, "Completed on", time(NULL));
+
ahprintf(AH, "--\n-- PostgreSQL database dump complete\n--\n\n");
/*
}
if (AH->currentTE != NULL && AH->currentTE != AH->lastErrorTE)
{
- write_msg(modulename, "Error from TOC entry %d; %u %u %s %s %s\n", AH->currentTE->dumpId,
+ write_msg(modulename, "Error from TOC entry %d; %u %u %s %s %s\n",
+ AH->currentTE->dumpId,
AH->currentTE->catalogId.tableoid, AH->currentTE->catalogId.oid,
AH->currentTE->desc, AH->currentTE->tag, AH->currentTE->owner);
}
else
return true;
}
+
+
+/*
+ * dumpTimestamp
+ */
+static void
+dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim)
+{
+ char buf[256];
+
+ if (strftime(buf, 256, "%Y-%m-%d %H:%M:%S %Z", localtime(&tim)) != 0)
+ ahprintf(AH, "-- %s %s\n\n", msg, buf);
+}
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.406 2005/04/12 04:26:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.407 2005/04/15 16:40:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
-#include <time.h>
#ifndef HAVE_STRDUP
#include "strdup.h"
static const char *fmtQualifiedId(const char *schema, const char *id);
static int dumpBlobs(Archive *AH, void *arg);
static void dumpDatabase(Archive *AH);
-static void dumpTimestamp(Archive *AH, char *msg);
static void dumpEncoding(Archive *AH);
static const char *getAttrName(int attrnum, TableInfo *tblInfo);
static const char *fmtCopyColumnList(const TableInfo *ti);
* safe order.
*/
- if (g_fout->verbose)
- dumpTimestamp(g_fout, "Started on");
-
/* First the special encoding entry. */
dumpEncoding(g_fout);
for (i = 0; i < numObjs; i++)
dumpDumpableObject(g_fout, dobjs[i]);
- if (g_fout->verbose)
- dumpTimestamp(g_fout, "Completed on");
-
/*
* And finally we can do the actual output.
*/
ropt->noOwner = outputNoOwner;
ropt->disable_triggers = disable_triggers;
ropt->use_setsessauth = use_setsessauth;
+ ropt->dataOnly = dataOnly;
if (compressLevel == -1)
ropt->compression = 0;
}
-/*
- * dumpTimestamp
- */
-static void
-dumpTimestamp(Archive *AH, char *msg)
-{
- char buf[256];
- time_t now = time(NULL);
-
- if (strftime(buf, 256, "%Y-%m-%d %H:%M:%S %Z", localtime(&now)) != 0)
- {
- PQExpBuffer qry = createPQExpBuffer();
-
- appendPQExpBuffer(qry, "-- ");
- appendPQExpBuffer(qry, msg);
- appendPQExpBuffer(qry, " ");
- appendPQExpBuffer(qry, buf);
- appendPQExpBuffer(qry, "\n");
-
- ArchiveEntry(AH, nilCatalogId, createDumpId(),
- "DUMP TIMESTAMP", NULL, NULL, "",
- false, "DUMP TIMESTAMP", qry->data, "", NULL,
- NULL, 0,
- NULL, NULL);
- destroyPQExpBuffer(qry);
- }
-}
-
-
/*
* dumpEncoding: put the correct encoding into the archive
*/