[Pljava-dev] ResultSet from trigger screwy with timestamp type

Burtenshaw, John J. JBurtenshaw at cooperstandard.com
Wed Aug 31 15:19:15 UTC 2005


Greetings.  I am using PLJava to fire a trigger on a table as such:

CREATE FUNCTION statsupdate( ) 
		RETURNS "trigger"
		LANGUAGE 'java' 
		AS 'com.cooperstandard.statsanalysis.RheologicTrigger.tfunction';

CREATE TRIGGER mv_trigger AFTER INSERT ON mv_results FOR EACH ROW EXECUTE PROCEDURE statsupdate();

The 'mv_table' that the trigger is made on appears below:

Column 	        Type
batch_number 	integer 	
date 	        timestamp 
part_number 	text 
compound 	text 	
batch_status 	character(1) 	
ml_torq 	double precision 	
mlplus2_torq 	double precision 	
mlplus4_torq 	double precision 	
ts5_time 	double precision 	
ts10_time 	double precision 	
ts35_time 	double precision 	
internal_status character(1)
instrument 	integer 


Everything is fine till the ResultSet from the trigger is examined which shows something other than the correct
value for the 'date' column which is a timestamp type. 
For example the statement "insert into mv_results values( 1011784, 'now', '63484', '9620-60', 'a', 50.4, 51.3, 0, 0, 0, 0, 'a', 6);'

Puts a timestamp of '2005-08-31 10:01:21.731671-04' into the database, but the java code:

   public static void tfunction( TriggerData td ) throws SQLException, Exception
    {
      ResultSet insertedRow = td.getNew();
      Logger.getAnonymousLogger().info( "The date: " + insertedRow.getTimestamp("date"));
 ....

gives:
Aug 31 10:01:22 r3development postgres[2636]: [27-1] INFO:  31 Aug 05 09:01:22 com.cooperstandard.stats
analysis.RheologicTrigger The date: 1975-09-22 02:47:56.000671

All the other column give the correct value.  Is there something I am missing?  Your thoughts would be appreciated.


Regards,
John Burtenshaw

PS
I am using postgresql 8.0 on a linux (debian) platform and the binary version pljava (vs the gcj version).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/pljava-dev/attachments/20050831/3ff059f0/attachment.html 


More information about the Pljava-dev mailing list