Received: from mail1.chek.com (lisa.synacor.com [208.197.227.27]) by postgresql.org (Postfix) with SMTP id F3C0D474E49 for ; Wed, 24 Jul 2002 08:44:34 -0400 (EDT) Received: (qmail 9163 invoked by uid 0); 24 Jul 2002 12:44:38 -0000 Received: from perthesep.installs.com (HELO host112.installs.ops) (206.24.104.131) by lisa-private.synacor.com with SMTP; 24 Jul 2002 12:44:38 -0000 Subject: Re: Odd error in timestamp processing From: "Robert M. Meyer" To: Tim Ellis Cc: jboes@nexcerpt.com, pgsql-admin@postgresql.org In-Reply-To: <20020723142528.77dff668.Tim.Ellis@gamet.com> References: <1027449659.25568.37.camel@skymaster> <20020723142528.77dff668.Tim.Ellis@gamet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/1.0.2-5mdk Date: 24 Jul 2002 08:44:56 -0400 Message-Id: <1027514696.7226.4.camel@skymaster> Mime-Version: 1.0 X-Archive-Number: 200207/336 X-Sequence-Number: 5020 You're right on that. I actually grepped my database dump to find all occurrences of ':60' and only found three dates and no other matches. Since that was the case, I went with the simple sed script (I was pretty tired at that point) and it worked for me. I was about to copy out your script, but I remembered that all of my databases have been upgraded so I don't need to worry about that any more. I like the script, though. Cheers! Bob On Tue, 2002-07-23 at 17:25, Tim Ellis wrote: > > We had this problem, too. Very annoying. It appears to be a bug in > > 7.1.x. The way we got around it was to dump the DB out to a file and > > run sed on the file with the script: > > s/:60/:59/ > > > > Then feeding that output into psql. > > > > Of course, our database doesn't use ':' followed by numbers for anything > > but timestamps so your mileage may vary. > > Not knowing your dataset, it's safer to run it through a Perl script > using: > > if ($line =~ /^(.*?)(\d\d:\d\d:)60(\.\d\d-\d\d.*)$/) { > $newLine = $1 . $2 . "59" . $3; > } else { > $newLine = $line; > } > > This pretty much makes sure that any ":60" you get is within a string like > **:**:60:**-** where each * is a 0-9. > > That, or use awk as well as sed to make sure you get the proper :60 > replaced. > > In any case, I wouldn't trust my large dataset to contain only improper > :60's. I've been bitten too many times by a too-generic s/XYZ/ABC/ in > the past. > > -- > Tim Ellis > Senior Database Architect > Gamet, Inc. > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Robert M. Meyer Sr. Network Administrator DigiVision Satellite Services 14 Lafayette Sq, Ste 410 Buffalo, NY 14203-1904 (716)332-1451