*** src/bin/pg_dump/pg_dump.c.orig Fri Jan 11 18:21:55 2002 --- src/bin/pg_dump/pg_dump.c Thu Jan 17 20:51:50 2002 *************** *** 89,94 **** --- 89,95 ---- static Oid findLastBuiltinOid_V71(const char *); static Oid findLastBuiltinOid_V70(void); static void setMaxOid(Archive *fout); + static int setMaxOid_dumper(Archive *fout, char *oid, void *dctxv); static void AddAcl(char *aclbuf, const char *keyword); static char *GetPrivileges(Archive *AH, const char *s); *************** *** 4538,4552 **** /* * setMaxOid - ! * find the maximum oid and generate a COPY statement to set it ! */ static void setMaxOid(Archive *fout) { PGresult *res; Oid max_oid; - char sql[1024]; res = PQexec(g_conn, "CREATE TEMPORARY TABLE pgdump_oid (dummy int4)"); if (!res || --- 4539,4568 ---- /* * setMaxOid - ! * find the maximum oid and generate commands to reproduce it in the target ! */ static void setMaxOid(Archive *fout) { + ArchiveEntry(fout, "0", "Max OID", + "", NULL, + "CREATE TEMPORARY TABLE pgdump_oid (dummy int4);\n", + "", "", "", + NULL, NULL); + + ArchiveEntry(fout, "0", "Max OID", + "", NULL, "", "", + "COPY pgdump_oid WITH OIDS FROM stdin;\n", + "", + setMaxOid_dumper, NULL); + } + + static int + setMaxOid_dumper(Archive *fout, char *oid, void *dctxv) + { PGresult *res; Oid max_oid; res = PQexec(g_conn, "CREATE TEMPORARY TABLE pgdump_oid (dummy int4)"); if (!res || *************** *** 4578,4594 **** exit_nicely(); } PQclear(res); if (g_verbose) write_msg(NULL, "maximum system oid is %u\n", max_oid); - snprintf(sql, 1024, - "CREATE TEMPORARY TABLE pgdump_oid (dummy int4);\n" - "COPY pgdump_oid WITH OIDS FROM stdin;\n" - "%u\t0\n" - "\\.\n" - "DROP TABLE pgdump_oid;\n", - max_oid); ! ArchiveEntry(fout, "0", "Max OID", "", NULL, sql, "", "", "", NULL, NULL); } /* --- 4594,4609 ---- exit_nicely(); } PQclear(res); + if (g_verbose) write_msg(NULL, "maximum system oid is %u\n", max_oid); ! archprintf(fout, ! "%u\t0\n" ! "\\.\n", ! max_oid); ! ! return 1; } /*