Skip to content

Commit d877de9

Browse files
committed
Make pg_dump --oids work when default_with_oids = off. Per report from
Michael Fuhr.
1 parent 10e5a75 commit d877de9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.397 2004/12/31 22:03:08 pgsql Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.398 2005/01/04 22:27:46 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -7157,8 +7157,12 @@ setMaxOid(Archive *fout)
71577157
Oid max_oid;
71587158
char sql[1024];
71597159

7160-
do_sql_command(g_conn,
7161-
"CREATE TEMPORARY TABLE pgdump_oid (dummy integer)");
7160+
if (fout->remoteVersion >= 70200)
7161+
do_sql_command(g_conn,
7162+
"CREATE TEMPORARY TABLE pgdump_oid (dummy integer) WITH OIDS");
7163+
else
7164+
do_sql_command(g_conn,
7165+
"CREATE TEMPORARY TABLE pgdump_oid (dummy integer)");
71627166
res = PQexec(g_conn, "INSERT INTO pgdump_oid VALUES (0)");
71637167
check_sql_result(res, g_conn, "INSERT INTO pgdump_oid VALUES (0)",
71647168
PGRES_COMMAND_OK);
@@ -7173,7 +7177,7 @@ setMaxOid(Archive *fout)
71737177
if (g_verbose)
71747178
write_msg(NULL, "maximum system OID is %u\n", max_oid);
71757179
snprintf(sql, sizeof(sql),
7176-
"CREATE TEMPORARY TABLE pgdump_oid (dummy integer);\n"
7180+
"CREATE TEMPORARY TABLE pgdump_oid (dummy integer) WITH OIDS;\n"
71777181
"COPY pgdump_oid WITH OIDS FROM stdin;\n"
71787182
"%u\t0\n"
71797183
"\\.\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy