Обсуждение: pg_dump crashes trying to dump database containing index on oid

Поиск
Список
Период
Сортировка

pg_dump crashes trying to dump database containing index on oid

От
Adam Haberlach
Дата:
Reply-To:

==========================================================================
POSTGRESQL BUG REPORT TEMPLATE
==========================================================================

Your name               : Adam Haberlach
Your email address      : adam@be.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel Pentium II

  Operating System (example: Linux 2.0.26 ELF)  : Linux version 2.2.2
(adam@bugnow) (gcc version 2.7.2.3) #1 Sat Mar 6 02:31:09 PST 1999

  PostgreSQL version (example: PostgreSQL-6.5.1):  PostgreSQL 7.0.0 on
i686-pc-linux-gnu, compiled by gcc 2.7.2.3

  Compiler used (example:  gcc 2.8.0)           :


Please enter a FULL description of your problem:
------------------------------------------------

pg_dump crashes trying to dump database containing index on oid



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------


createdb snafu
psql -d snafu
CREATE TABLE test (test text);
CREATE INDEX idx_test_oid ON test (oid);
\q
pg_dump snafu

This sequence crashes while gathering index information with:
parseNumericArray: bogus number

This occurs because the 'indkey' field in the query used by pg_dump
contains a '-2', which crashes its Numeric Array parser.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

I believed the simplest fix would be to update the parser to handle the
negative numbers--cursory examination shows that it shouldn't be too
hard.  On the other hand, there may be problems with creating indexes
on oids.  This database worked just fine with Postgres 6.4.3


--
Adam Haberlach             |"You have to understand that the
adam@newsnipple.com        |  entire 'Net is based on people with
http://www.newsnipple.com/ |  too much free time on their hands."

Re: pg_dump crashes trying to dump database containing index on oid

От
Tom Lane
Дата:
Adam Haberlach <adam@newsnipple.com> writes:
> pg_dump crashes trying to dump database containing index on oid

You're a day too late to be the first reporter of this bug ;-).
See patch on pgpatches (yup, it's the obvious fix).

            regards, tom lane

Re: pg_dump crashes trying to dump database containing index on oid

От
Adam Haberlach
Дата:
On Tue, May 23, 2000 at 01:27:28AM -0400, Tom Lane wrote:
> Adam Haberlach <adam@newsnipple.com> writes:
> > pg_dump crashes trying to dump database containing index on oid
>
> You're a day too late to be the first reporter of this bug ;-).
> See patch on pgpatches (yup, it's the obvious fix).

    Hmm--I didn't seem to get that one (and I've been subscribed
to pgsql-patches for nearly a month).

--
Adam Haberlach             |"You have to understand that the
adam@newsnipple.com        |  entire 'Net is based on people with
http://www.newsnipple.com/ |  too much free time on their hands."

Re: pg_dump crashes trying to dump database containing index on oid

От
Tom Lane
Дата:
Adam Haberlach <adam@newsnipple.com> writes:
> On Tue, May 23, 2000 at 01:27:28AM -0400, Tom Lane wrote:
>> Adam Haberlach <adam@newsnipple.com> writes:
>>>> pg_dump crashes trying to dump database containing index on oid
>>
>> You're a day too late to be the first reporter of this bug ;-).
>> See patch on pgpatches (yup, it's the obvious fix).

>     Hmm--I didn't seem to get that one (and I've been subscribed
> to pgsql-patches for nearly a month).

Now that you mention it, my mail log shows that it came back to me
via -hackers, but *not* via -patches.  The outgoing copy is appended.

Marc, I think the evidence is indisputable that majordomo has been
dropping some traffic for the past few days ... this makes at least
four separate reports ...

            regards, tom lane


To: pgsql-hackers@postgreSQL.org, pgsql-patches@postgresql.org
Subject: Sigh: 7.0 pg_dump fails if user table has index on OID
Date: Fri, 19 May 2000 19:16:40 -0400
Message-ID: <10300.958778200@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>

If any user-created index is on a system column (eg, OID),
7.0 pg_dump fails with "parseNumericArray: bogus number".

Mea culpa, mea maxima culpa --- some well-intentioned error checking
code was a bit too tight.  (But how'd this get through beta with no
one noticing?  It's been broken since January...)

The attached patch is committed for 7.0.1, but you will need to apply
it by hand if you have such indexes and you want to make a dump before
7.0.1 comes out.  (Alternatively, drop the indexes and remake them
by hand later.)

Thanks to Kyle Bateman for the bug report.

            regards, tom lane

*** src/bin/pg_dump/common.c.orig    Wed Apr 12 13:16:14 2000
--- src/bin/pg_dump/common.c    Fri May 19 19:00:00 2000
***************
*** 190,196 ****
          }
          else
          {
!             if (!isdigit(s) || j >= sizeof(temp) - 1)
              {
                  fprintf(stderr, "parseNumericArray: bogus number\n");
                  exit(2);
--- 190,196 ----
          }
          else
          {
!             if (!(isdigit(s) || s == '-') || j >= sizeof(temp) - 1)
              {
                  fprintf(stderr, "parseNumericArray: bogus number\n");
                  exit(2);