Incorrect "invalid AM/PM string" error from to_timestamp - Mailing list pgsql-bugs

From Joshua Tolley
Subject Incorrect "invalid AM/PM string" error from to_timestamp
Date
Msg-id e7e0a2570809250905h2ad60d7cj33a490816341538b@mail.gmail.com
Whole thread Raw
Responses Re: Incorrect "invalid AM/PM string" error from to_timestamp
List 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@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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4436: (E'\\' LIKE E'\\') => f
Next
From: Tom Lane
Date:
Subject: Re: Incorrect "invalid AM/PM string" error from to_timestamp