Make pg_dump --oids work when default_with_oids = off. Per report from
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jan 2005 22:27:46 +0000 (22:27 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Jan 2005 22:27:46 +0000 (22:27 +0000)
Michael Fuhr.

src/bin/pg_dump/pg_dump.c

index 65e064694746b7aae8cf2d52d99e9a49e6779606..afc6bf5b1826f65c78cf3facc0774857c215767d 100644 (file)
@@ -7157,8 +7157,12 @@ setMaxOid(Archive *fout)
        Oid                     max_oid;
        char            sql[1024];
 
-       do_sql_command(g_conn,
-                                  "CREATE TEMPORARY TABLE pgdump_oid (dummy integer)");
+       if (fout->remoteVersion >= 70200)
+               do_sql_command(g_conn,
+                                          "CREATE TEMPORARY TABLE pgdump_oid (dummy integer) WITH OIDS");
+       else
+               do_sql_command(g_conn,
+                                          "CREATE TEMPORARY TABLE pgdump_oid (dummy integer)");
        res = PQexec(g_conn, "INSERT INTO pgdump_oid VALUES (0)");
        check_sql_result(res, g_conn, "INSERT INTO pgdump_oid VALUES (0)",
                                         PGRES_COMMAND_OK);
@@ -7173,7 +7177,7 @@ setMaxOid(Archive *fout)
        if (g_verbose)
                write_msg(NULL, "maximum system OID is %u\n", max_oid);
        snprintf(sql, sizeof(sql),
-                        "CREATE TEMPORARY TABLE pgdump_oid (dummy integer);\n"
+                        "CREATE TEMPORARY TABLE pgdump_oid (dummy integer) WITH OIDS;\n"
                         "COPY pgdump_oid WITH OIDS FROM stdin;\n"
                         "%u\t0\n"
                         "\\.\n"