pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Ellis <Tim.Ellis@gamet.com>
To: Robert M. Meyer <rmeyer@installs.com>
Cc: jboes@nexcerpt.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Odd error in timestamp processing
Date: Tue, 23 Jul 2002 14:25:28 -0700
Message-ID: <20020723142528.77dff668.Tim.Ellis@gamet.com> (raw)
In-Reply-To: <1027449659.25568.37.camel@skymaster>
References: <ahk6em$uo5$1@news.hub.org>
	<1027449659.25568.37.camel@skymaster>

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



view thread (4+ messages)  latest in thread

Message-ID: <20020723142528.77dff668.Tim.Ellis@gamet.com>
Permalink:  ../20020723142528.77dff668.Tim.Ellis@gamet.com/
Also on:    postgresql.org/message-id/20020723142528.77dff668.Tim.Ellis@gamet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: Tim.Ellis@gamet.com, rmeyer@installs.com, jboes@nexcerpt.com
  Subject: Re: Odd error in timestamp processing
  In-Reply-To: <20020723142528.77dff668.Tim.Ellis@gamet.com>
  References: <ahk6em$uo5$1@news.hub.org> <1027449659.25568.37.camel@skymaster> <20020723142528.77dff668.Tim.Ellis@gamet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox