Re: backup + restore fails

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andreas Seltenreich <andreas+pg(at)gate450(dot)dyndns(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, "Schoenen, Holger" <holger(dot)schoenen(at)sds-bs(dot)de>
Subject: Re: backup + restore fails
Date: 2006-11-21 22:46:29
Message-ID: 200611212246.kALMkTU18769@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


This will be fixed in 8.2 by suppressing %Z on Windows.

---------------------------------------------------------------------------

Andreas Seltenreich wrote:
> 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);
> }
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message anil maran 2006-11-22 01:17:18 Error in postgresql after crash unable to restart this needs to be posted on -hackers or -bugs, so that tom, oleg and teodor can take a look
Previous Message Tom Lane 2006-11-21 22:20:30 Re: backup + restore fails

Browse pgsql-hackers by date

  From Date Subject
Next Message anil maran 2006-11-22 01:17:18 Error in postgresql after crash unable to restart this needs to be posted on -hackers or -bugs, so that tom, oleg and teodor can take a look
Previous Message Tom Lane 2006-11-21 22:20:30 Re: backup + restore fails