Re: Odd error in timestamp processing

From: Tim Ellis <Tim(dot)Ellis(at)gamet(dot)com>
To: "Robert M(dot) Meyer" <rmeyer(at)installs(dot)com>
Cc: jboes(at)nexcerpt(dot)com, pgsql-admin(at)postgresql(dot)org
Subject: Re: Odd error in timestamp processing
Date: 2002-07-23 21:25:28
Message-ID: 20020723142528.77dff668.Tim.Ellis@gamet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> 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.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2002-07-23 21:53:52 Re: Problem with database I need to repair...
Previous Message Michael G. Martin 2002-07-23 20:45:32 Re: Postgres performance slowly gets worse over a month