Re: pg_restore fails with a custom backup file

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>, pgsql-hackers(at)postgresql(dot)org, Yoshiyuki Asaba <y-asaba(at)sraoss(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: pg_restore fails with a custom backup file
Date: 2006-12-18 17:49:45
Message-ID: 4586D4B9.9060201@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
> Magnus Hagander wrote:
>> Index: src/bin/pg_dump/pg_dump.h
>> ===================================================================
>> RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dump.h,v
>> retrieving revision 1.130
>> diff -c -r1.130 pg_dump.h
>> *** src/bin/pg_dump/pg_dump.h 9 Oct 2006 23:36:59 -0000 1.130
>> --- src/bin/pg_dump/pg_dump.h 18 Dec 2006 14:33:16 -0000
>> ***************
>> *** 16,21 ****
>> --- 16,33 ----
>> #include "postgres_fe.h"
>> + #ifdef WIN32
>> + /*
>> + * WIN32 does not provide a 64-bit off_t, but it does provide
>> functions operating
>> + * with 64-bit offsets. Redefine off_t to what's always a 64-bit
>> int, and redefine
>> + * the functions that accept off_t to be the 64-bit only ones.
>> + */
>> + #define off_t __int64
>> + #undef fseeko
>> + #define fseeko(stream, offset, origin) _fseeki64(stream, offset,
>> origin)
>> + #undef ftello
>> + #define ftello(stream) _ftelli64(stream)
>> + #endif
>> /*
>> * pg_dump uses two different mechanisms for identifying database
>> objects:
>>
>
> This patch appears to be broken on my MinGW setup:
>
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g
> -DFRONTEND -I../../../src/interfaces/libpq -I../.
> ./../src/include -I./src/include/port/win32 -DEXEC_BACKEND
> -I/c/tcl/include "-I../../../src/include/port/win32" -c -o common.o
> common.c -MMD -MP -MF .deps/common.Po
> In file included from
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/zconf.h:289,
> from
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/zlib.h:34,
> from pg_backup_archiver.h:44,
> from common.c:20:
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/unistd.h:23:
> error: conflicting types for 'chsize'
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/io.h:271:
> error: previous declaration of 'chsize' was here
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/unistd.h:23:
> error: conflicting types for 'chsize'
> c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/io.h:271:
> error: previous declaration of 'chsize' was here
>
>
> I suspect we might need to create a pg_off_t type or some such gadget.
>
> Bleah.
>
> But it does need to be fixed.

Bummer. That might be what's needed, but I'm going to at least try to
find some neater way first. I wonder why it didn't happen on MSVC...

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-12-18 17:56:49 Re: pg_restore fails with a custom backup file
Previous Message Andrew Dunstan 2006-12-18 17:41:49 Re: pg_restore fails with a custom backup file