pg_dump --oids fails when default_with_oids = off

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump --oids fails when default_with_oids = off
Date: 2005-01-04 17:58:26
Message-ID: 20050104175826.GA92283@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PostgreSQL 8.0.0rc3

When default_with_oids is set to "off", pg_dump --oids fails with
the following error:

% pg_dump --oids test
pg_dump: inserted invalid OID

This prevents the ability to dump OIDs for tables that were created
WITH OIDS. The workaround is to set default_with_oids to "on".

The problem appears to be in setMaxOid() in src/bin/pg_dump/pg_dump.c:

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);
max_oid = PQoidValue(res);
if (max_oid == 0)
{
write_msg(NULL, "inserted invalid OID\n");
exit_nicely();
}

Should the temporary table be created WITH OIDS, or is this a case
of "Doctor, it hurts when I do that"?

pg_restore might have a similar problem but I'll have to look at
that later this afternoon.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Graham Robson 2005-01-04 20:10:16 BUG #1372: Service won't start with tcpip_socket = true
Previous Message T.J. 2005-01-04 17:39:06 Re: More SSL questions..