Hi,
From: "Hiroshi Saito" <[EMAIL PROTECTED]>
Subject: Re: [HACKERS] pg_restore fails with a custom backup file
Date: Fri, 15 Dec 2006 00:57:50 +0900
> > Win32 does not implement fseeko() and ftello(). So I think it limit to
> > handle a 2GB file. Is this a specification?
>
> Yes, Magnus-san suggested the problem. It is present TODO. The entire
> adjustment was still difficult though I had tried it. SetFilePointer might be
> able to be saved. However, I think it might be an attempt of 8.3...
Is it able to use fsetpos()/fgetpos() instead of ftell()/fseek()?
fpos_t is a 8byte type. I tested pg_dump/pg_restore with the attached
patch.
--
Yoshiyuki Asaba
[EMAIL PROTECTED]
Index: src/include/c.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.214
diff -c -r1.214 c.h
*** src/include/c.h 4 Oct 2006 00:30:06 -0000 1.214
--- src/include/c.h 19 Dec 2006 12:52:05 -0000
***************
*** 74,79 ****
--- 74,82 ----
#include <strings.h>
#endif
#include <sys/types.h>
+ #ifdef WIN32
+ #define off_t fpos_t
+ #endif
#include <errno.h>
#if defined(WIN32) || defined(__CYGWIN__)
Index: src/include/port.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port.h,v
retrieving revision 1.106
diff -c -r1.106 port.h
*** src/include/port.h 28 Nov 2006 01:12:33 -0000 1.106
--- src/include/port.h 19 Dec 2006 12:52:05 -0000
***************
*** 307,313 ****
extern char *crypt(const char *key, const char *setting);
#endif
! #if defined(bsdi) || defined(netbsd)
extern int fseeko(FILE *stream, off_t offset, int whence);
extern off_t ftello(FILE *stream);
#endif
--- 307,313 ----
extern char *crypt(const char *key, const char *setting);
#endif
! #if defined(bsdi) || defined(netbsd) || defined(WIN32)
extern int fseeko(FILE *stream, off_t offset, int whence);
extern off_t ftello(FILE *stream);
#endif
Index: src/include/port/win32.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.63
diff -c -r1.63 win32.h
*** src/include/port/win32.h 19 Oct 2006 20:03:08 -0000 1.63
--- src/include/port/win32.h 19 Dec 2006 12:52:05 -0000
***************
*** 20,25 ****
--- 20,27 ----
#include <sys/utime.h> /* for non-unicode version */
#undef near
+ #define HAVE_FSEEKO
+
/* Must be here to avoid conflicting with prototype in windows.h */
#define mkdir(a,b) mkdir(a)
Index: src/port/fseeko.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/fseeko.c,v
retrieving revision 1.20
diff -c -r1.20 fseeko.c
*** src/port/fseeko.c 5 Mar 2006 15:59:10 -0000 1.20
--- src/port/fseeko.c 19 Dec 2006 12:52:06 -0000
***************
*** 17,23 ****
* We have to use the native defines here because configure hasn't
* completed yet.
*/
! #if defined(__bsdi__) || defined(__NetBSD__)
#include "c.h"
--- 17,23 ----
* We have to use the native defines here because configure hasn't
* completed yet.
*/
! #if defined(__bsdi__) || defined(__NetBSD__) || defined(WIN32)
#include "c.h"
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at
http://www.postgresql.org/about/donate