Re: backup + restore fails

Поиск
Список
Период
Сортировка
От Andreas Seltenreich
Тема Re: backup + restore fails
Дата
Msg-id 877iyu3hpc.fsf@gate450.dyndns.org
обсуждение исходный текст
Ответы Re: [BUGS] backup + restore fails  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [BUGS] backup + restore fails  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Holger Schoenen writes:

> ERROR:  invalid byte sequence for encoding "UTF8": 0xe46973
>     Command was: --
[...]
> -- Started on 2006-09-15 14:56:51 Westeuropäische Normalzeit

The same problem was recently reported on the pgsql-de-allgemein list.

Would just avoiding %Z in Win32's strftime be an acceptable solution?
elog.c is already doing this, however because of the length of the
zone names, not the localization problem.  The attached patch is
completely untested because I don't have access to a win32 box.

regards,
andreas

Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.137
diff -c -r1.137 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c    14 Oct 2006 23:07:22 -0000    1.137
--- src/bin/pg_dump/pg_backup_archiver.c    20 Oct 2006 18:59:11 -0000
***************
*** 2780,2785 **** {     char        buf[256]; 
!     if (strftime(buf, 256, "%Y-%m-%d %H:%M:%S %Z", localtime(&tim)) != 0)         ahprintf(AH, "-- %s %s\n\n", msg,
buf);}
 
--- 2780,2793 ---- {     char        buf[256]; 
!     if (strftime(buf, 256,
!                  /* Win32 timezone names are long and localized and
!                   * can interfere with utf-8 dumps */
! #ifndef WIN32
!                  "%Y-%m-%d %H:%M:%S %Z",
! #else
!                  "%Y-%m-%d %H:%M:%S",
! #endif
!                  localtime(&tim)) != 0)         ahprintf(AH, "-- %s %s\n\n", msg, buf); }
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.84
diff -c -r1.84 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c    7 Oct 2006 20:59:05 -0000    1.84
--- src/bin/pg_dump/pg_dumpall.c    20 Oct 2006 18:59:12 -0000
***************
*** 1320,1325 ****     char        buf[256];     time_t        now = time(NULL); 
!     if (strftime(buf, 256, "%Y-%m-%d %H:%M:%S %Z", localtime(&now)) != 0)         printf("-- %s %s\n\n", msg, buf);
}
--- 1320,1333 ----     char        buf[256];     time_t        now = time(NULL); 
!     if (strftime(buf, 256,
!                  /* Win32 timezone names are long and localized and
!                   * can interfere with utf-8 dumps */
! #ifndef WIN32
!                  "%Y-%m-%d %H:%M:%S %Z",
! #else
!                  "%Y-%m-%d %H:%M:%S",
! #endif
!                  localtime(&now)) != 0)         printf("-- %s %s\n\n", msg, buf); }


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [SPAM?] Re: Asynchronous I/O Support
Следующее
От: "Simon Riggs"
Дата:
Сообщение: Re: misbehaving planer?