Incorrect "invalid AM/PM string" error from to_timestamp

From: "Joshua Tolley" <eggyknap(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Incorrect "invalid AM/PM string" error from to_timestamp
Date: 2008-09-25 16:05:17
Message-ID: e7e0a2570809250905h2ad60d7cj33a490816341538b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I'm running this on 8.4devel built from CVS HEAD as of 9:44 AM Moutain
Daylight time today, on a 32-bit Ubuntu 7.04 box. This is a completely
new database.

jtolley(at)polonium:~/devel/raybo$ psql raybo -f test.sql
CREATE TABLE
INSERT 0 1
INSERT 0 1
psql:test.sql:21: ERROR: invalid AM/PM string
psql:test.sql:22: ERROR: invalid AM/PM string

The script in question is below:

CREATE TABLE ft (
id1 numeric(13,0),
am1 numeric(13,2),
am1 numeric(13,2),
ct timestamp without time zone
);

-- -- The commands below come from a dataset I was loading. While
trying to reduce the problem to a small test case, I found that
various combinations of
-- -- the available columns showed the error, and others did not. The
commands below are one set that don't display the error.
-- INSERT INTO ft (am1, am2, ct) VALUES (45749.25, 45749.25,
to_timestamp('21-SEP-08 03.26.04.378954 AM', 'DD-MON-YY HH.MI.SS.US
AM'));
-- INSERT INTO ft (am1, am2, ct) VALUES (60, 60,
to_timestamp('21-SEP-08 08.15.42.950620 PM', 'DD-MON-YY HH.MI.SS.US
AM'));
-- INSERT INTO ft (am1, am2, ct) VALUES (46.17, 46.17,
to_timestamp('21-SEP-08 08.15.42.950620 PM', 'DD-MON-YY HH.MI.SS.US
AM'));
-- INSERT INTO ft (am1, am2, ct) VALUES (61.55, 61.55,
to_timestamp('21-SEP-08 03.26.04.350738 AM', 'DD-MON-YY HH.MI.SS.US
AM'));

-- -- This set of commands shows the error. Note that running these
statements in a different order, or inserting other commands into the
statements, or other
-- -- such modifications may very well prevent the error from occurring.
INSERT INTO ft (id1, am1, ct) VALUES (6924257, 45749.25,
to_timestamp('21-SEP-08 03.26.04.378954 AM', 'DD-MON-YY HH.MI.SS.US
AM'));
INSERT INTO ft (id1, am1, ct) VALUES (6924611, 60,
to_timestamp('21-SEP-08 08.15.42.950620 PM', 'DD-MON-YY HH.MI.SS.US
AM'));
INSERT INTO ft (id1, am1, ct) VALUES (6924612, 46.17,
to_timestamp('21-SEP-08 08.15.42.950620 PM', 'DD-MON-YY HH.MI.SS.US
AM'));
INSERT INTO ft (id1, am1, ct) VALUES (6924254, 61.55,
to_timestamp('21-SEP-08 03.26.04.350738 AM', 'DD-MON-YY HH.MI.SS.US
AM'));

-- Josh Tolley / eggyknap

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tim Leppard 2008-09-25 16:15:43 BUG #4437: Breaking referential integrity with a trigger
Previous Message Tom Lane 2008-09-24 20:00:54 Re: BUG #4436: (E'\\' LIKE E'\\') => f