Re: [SQL] Timestamp output
Re: [SQL] Timestamp output
От:
Barry Lind <barry@xythos.com>
Дата:
Andreas, I can't reproduce the problem you are seeing. I created a table 'test' with one column of type timestamp. Inserted one row with the value from now(). And then ran a simple jdbc program to select out that one row. This all worked without errors. Again I ask are you using the latest 7.2 driver? I know there where some bugs in earlier 7.2 drivers (I think in all of the betas actually) that look similar to the problem you are reporting. thanks, --Barry Andreas Joseph Krogh wrote: > On Tuesday 05 February 2002 11:59, you wrote: > >>Andreas, >> >>Are you using the latest 7.2 driver? I don't have any problems with >>this using the latst 7.2 driver. If you are using the latest driver, >>can you send in a test case that reproduces this problem? >> > > I have the following table: > CREATE TABLE FORUMARTICLE( > ARTICLEID SERIAL NOT NULL PRIMARY KEY, > FORUMID INTEGER NOT NULL REFERENCES FORUM(FORUMID), > CATEGORYID INTEGER NOT NULL REFERENCES CATEGORY(CATEGORYID), > SUBJECT VARCHAR(512) NOT NULL, > LEADTEXT VARCHAR(4000), > BODY VARCHAR(4000) NOT NULL, > USERNAME VARCHAR(64) NOT NULL, > CREATED TIMESTAMP DEFAULT 'now' NOT NULL, > LASTPOSTING TIMESTAMP, > LASTPOSTINGBY VARCHAR(64), > ISAPPROVED INTEGER DEFAULT 0 NOT NULL, > APPROVEDBY INTEGER DEFAULT 0 NOT NULL > ); > > I have the following trigger on FORUMARTICLE: > CREATE FUNCTION stamp_article () RETURNS OPAQUE AS ' > BEGIN > -- Check that lastpostingby is given > IF NEW.LASTPOSTINGBY ISNULL THEN > RAISE EXCEPTION ''LASTPOSTINGBY cannot be NULL value''; > END IF; > > -- Remember when LASTPOSTINGBY changed > NEW.LASTPOSTING := ''now''; > RETURN NEW; > END; > ' LANGUAGE 'plpgsql'; > > CREATE TRIGGER stamp_article BEFORE UPDATE ON FORUMARTICLE > FOR EACH ROW EXECUTE PROCEDURE stamp_article(); > > This causes the follogin entry in FORUMARTICLE: > > lastposting > ------------------------------ > 2002-02-26 18:32:54.83294+01 > > which throws the Exception in the JDBC driver as follows: > > Bad Timestamp Format at 23 in 2002-02-26 18:32:54.83294+01 > > I have the postgresql.jar from 7.2 in my classpath: > > diff ~/postgresql-7.2/src/interfaces/jdbc/jars/postgresql.jar > ~/catalina/common/lib/postgresql.jar > > echo $? > 0 > > >
Re: [SQL] Timestamp output
От:
Thomas O'Dowd <tom@nooper.com>
Дата:
On Thu, Feb 28, 2002 at 06:32:54PM -0800, Barry Lind wrote: > Andreas, > > I can't reproduce the problem you are seeing. I created a table 'test' > with one column of type timestamp. Inserted one row with the value from > now(). And then ran a simple jdbc program to select out that one row. > This all worked without errors. > > Again I ask are you using the latest 7.2 driver? I know there where > some bugs in earlier 7.2 drivers (I think in all of the betas actually) > that look similar to the problem you are reporting. Yep, that should definately be fixed in the latest 7.2 driver. Also, there is a patch waiting to fix a different timestamp bug which I submitted on Thu, 17 Jan 2002 22:57:08 which fixes the usage of timestamp without the timezone. Tom. -- Thomas O'Dowd. - Nooping - http://nooper.com tom@nooper.com - Testing - http://nooper.co.jp/labs