pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Odd error in timestamp processing
4+ messages / 3 participants
[nested] [flat]

* Odd error in timestamp processing
@ 2002-07-23 18:14  Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jeff Boes @ 2002-07-23 18:14 UTC (permalink / raw)
  To: pgsql-admin

Recently we transferred our database from a 7.1 system to a 7.2 using:

 $ pg_dump -h old_host | psql

During this, we saw this message:


ERROR:  copy: line 15926, Bad timestamp external representation
'2002-07-21 06:54:60.00-04'

(It's the '60 seconds' part of the timestamp that is causing the problem,
I'm sure.)  How might this have happened?  Some kind of rounding error?

-- 
Jeff Boes                                      vox 616.226.9550 ext 24
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                 http://www.nexcerpt.com
           ...Nexcerpt... Extend your Expertise



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Odd error in timestamp processing
@ 2002-07-23 18:40  Robert M. Meyer <rmeyer@installs.com>
  parent: Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Robert M. Meyer @ 2002-07-23 18:40 UTC (permalink / raw)
  To: Jeff Boes <jboes@nexcerpt.com>; +Cc: 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.

Hope this helps...

Cheers!

Bob

On Tue, 2002-07-23 at 14:14, Jeff Boes wrote:
> Recently we transferred our database from a 7.1 system to a 7.2 using:
> 
>  $ pg_dump -h old_host | psql
> 
> During this, we saw this message:
> 
> 
> ERROR:  copy: line 15926, Bad timestamp external representation
> '2002-07-21 06:54:60.00-04'
> 
> (It's the '60 seconds' part of the timestamp that is causing the problem,
> I'm sure.)  How might this have happened?  Some kind of rounding error?
> 
> -- 
> Jeff Boes                                      vox 616.226.9550 ext 24
> Database Engineer                                     fax 616.349.9076
> Nexcerpt, Inc.                                 http://www.nexcerpt.com
>            ...Nexcerpt... Extend your Expertise
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
-- 
Robert M. Meyer
Sr. Network Administrator
DigiVision Satellite Services
14 Lafayette Sq, Ste 410
Buffalo, NY 14203-1904
(716)332-1451




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Odd error in timestamp processing
@ 2002-07-23 21:25  Tim Ellis <Tim.Ellis@gamet.com>
  parent: Robert M. Meyer <rmeyer@installs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tim Ellis @ 2002-07-23 21:25 UTC (permalink / raw)
  To: Robert M. Meyer <rmeyer@installs.com>; +Cc: jboes@nexcerpt.com; 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.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Odd error in timestamp processing
@ 2002-07-24 12:44  Robert M. Meyer <rmeyer@installs.com>
  parent: Tim Ellis <Tim.Ellis@gamet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert M. Meyer @ 2002-07-24 12:44 UTC (permalink / raw)
  To: Tim Ellis <Tim.Ellis@gamet.com>; +Cc: jboes@nexcerpt.com; pgsql-admin

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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-07-24 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-23 18:14 Odd error in timestamp processing Jeff Boes <jboes@nexcerpt.com>
2002-07-23 18:40 ` Robert M. Meyer <rmeyer@installs.com>
2002-07-23 21:25   ` Tim Ellis <Tim.Ellis@gamet.com>
2002-07-24 12:44     ` Robert M. Meyer <rmeyer@installs.com>

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