Thread: Error in trying to dump any database

Error in trying to dump any database

From
Martin Weinberg
Date:
I have a 7.1.2 system which gives the following error on any pg_dump:

DumpComment: SELECT failed: 'ERROR:  dtoi4: integer out of range
'.

This happens with any database.  E.g. I made a very tiny database
with a single table and two records and the same error and message
is obtained.

As far as I can tell, all of the data is intact, queries work, etc.
Any ideas?

--Martin

Re: Error in trying to dump any database

From
Martin Weinberg
Date:
Thanks . . .

We did compile with gcc 2.95.2 but I think that something else may be
going on here.  Other machines with the same version of os (linux) and
libraries do not have this problem.  I tried moving the pg_dump binary
(and preloading the libpg library, verified with ldd) and it give the
same problem.  And I moved the executable and library from the problem
machine to the working one and no problem!


Colin Campbell wrote on Fri, 31 Aug 2001 11:42:21 +1000
>Hi,
>
>I recently had a similar problem (7.1.2) and I suspect you are suffering
>the same.  It turned out to (probably) be a compiler optimzation problem.
>I could do
>
>    select int4(4::int8/4::int8);
>
>and it would work on a machine compiled under gcc 2.95.2 but failed with
>"int8 conversion to int4 is out of range" on a box comiled under 2.7.2.1.
>
>My problem was with int84() and its offending code is almost identical to
>dtoi4() which is this little piece of goods here.
>
>        if ((num < INT_MIN) || (num > INT_MAX))
>                elog(ERROR, "dtoi4: integer out of range");
>
>If I were you I'd change this to
>
>    if (num < INT_MIN)
>                elog(ERROR, "dtoi4: integer out of range - too small");
>        if (num > INT_MAX)
>                elog(ERROR, "dtoi4: integer out of range - too big");
>
>recompile and the (hopefully) watch the problem go away.
>
>
>On Thu, 30 Aug 2001, Martin Weinberg wrote:
>
>> I have a 7.1.2 system which gives the following error on any pg_dump:
>>
>> DumpComment: SELECT failed: 'ERROR:  dtoi4: integer out of range
>> '.
>>
>> This happens with any database.  E.g. I made a very tiny database
>> with a single table and two records and the same error and message
>> is obtained.
>
>Colin
>

Re: Error in trying to dump any database

From
Colin Campbell
Date:
Hi,

I recently had a similar problem (7.1.2) and I suspect you are suffering
the same.  It turned out to (probably) be a compiler optimzation problem.
I could do

    select int4(4::int8/4::int8);

and it would work on a machine compiled under gcc 2.95.2 but failed with
"int8 conversion to int4 is out of range" on a box comiled under 2.7.2.1.

My problem was with int84() and its offending code is almost identical to
dtoi4() which is this little piece of goods here.

        if ((num < INT_MIN) || (num > INT_MAX))
                elog(ERROR, "dtoi4: integer out of range");

If I were you I'd change this to

    if (num < INT_MIN)
                elog(ERROR, "dtoi4: integer out of range - too small");
        if (num > INT_MAX)
                elog(ERROR, "dtoi4: integer out of range - too big");

recompile and the (hopefully) watch the problem go away.


On Thu, 30 Aug 2001, Martin Weinberg wrote:

> I have a 7.1.2 system which gives the following error on any pg_dump:
>
> DumpComment: SELECT failed: 'ERROR:  dtoi4: integer out of range
> '.
>
> This happens with any database.  E.g. I made a very tiny database
> with a single table and two records and the same error and message
> is obtained.

Colin