agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] ResultSet from trigger screwy with timestamp type
5+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] ResultSet from trigger screwy with timestamp type
@ 2005-08-31 15:19  
  0 siblings, 1 reply; 5+ messages in thread

From:  @ 2005-08-31 15:19 UTC (permalink / raw)


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://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050831/3ff059f0/attachment.html;



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

* [Pljava-dev] ResultSet from trigger screwy with timestamp type
@ 2005-09-01 05:59  
  parent: 
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2005-09-01 05:59 UTC (permalink / raw)

Hi John,
There has been some problems with timestamps before that where related 
to how PostgreSQL was compiled (using integer datetimes or not) but that 
was fixed some time ago to allow PL/Java dynamically adapt at runtime.

I'm a bit uncertain of what versions you are using. There's no binary 
distribution of PL/Java for gcj. Perhaps you consider gcj "binary java"? 
If so, what version of gcj do you have when you compile and what version 
of the PL/Java source are you using?

Regards,
Thomas Hallgren

Burtenshaw, John J. wrote:

>
> 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).
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Pljava-dev mailing list
>Pljava-dev at gborg.postgresql.org
>http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>  
>






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

* [Pljava-dev] ResultSet from trigger screwy with timestamp type
@ 2005-09-02 13:40  
  0 siblings, 1 reply; 5+ messages in thread

From:  @ 2005-09-02 13:40 UTC (permalink / raw)


Thomas:
Thanks for your reply.  Sorry for the confustion with gcj.  I am using the following 'binary' from the pljava home site:

pljava-i686-pc-linux-gnu-pg8.0-1.1.0.tar.gz

I believe it is PLJava 1.1.  I am also using Postgresql 8.0.3.  Is there a way of determining if the debian package of postgresql that I have installed is compiled with the integer/timestamp support?  I'm guessing that we want integer/timestamp support for PLjava to work properly.

Thanks in advance
John Burtenshaw




-----Original Message-----
From: pljava-dev-bounces at gborg.postgresql.org on behalf of Thomas Hallgren
Sent: Thu 9/1/2005 1:59 AM
To: Burtenshaw, John J.
Cc: pljava-dev at gborg.postgresql.org
Subject: Re: [Pljava-dev] ResultSet from trigger screwy with timestamp type
 
Hi John,
There has been some problems with timestamps before that where related 
to how PostgreSQL was compiled (using integer datetimes or not) but that 
was fixed some time ago to allow PL/Java dynamically adapt at runtime.

I'm a bit uncertain of what versions you are using. There's no binary 
distribution of PL/Java for gcj. Perhaps you consider gcj "binary java"? 
If so, what version of gcj do you have when you compile and what version 
of the PL/Java source are you using?

Regards,
Thomas Hallgren

Burtenshaw, John J. wrote:

>
> 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).
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Pljava-dev mailing list
>Pljava-dev at gborg.postgresql.org
>http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>  
>


_______________________________________________
Pljava-dev mailing list
Pljava-dev at gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/pljava-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050902/a665fd99/attachment.html;



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

* [Pljava-dev] ResultSet from trigger screwy with timestamp type
@ 2005-09-02 15:31  
  parent: 
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2005-09-02 15:31 UTC (permalink / raw)

Burtenshaw, John J. wrote:

>
> Thomas:
> Thanks for your reply.  Sorry for the confustion with gcj.  I am using 
> the following 'binary' from the pljava home site:
>
> pljava-i686-pc-linux-gnu-pg8.0-1.1.0.tar.gz
>
> I believe it is PLJava 1.1.  I am also using Postgresql 8.0.3.  Is 
> there a way of determining if the debian package of postgresql that I 
> have installed is compiled with the integer/timestamp support?  I'm 
> guessing that we want integer/timestamp support for PLjava to work 
> properly.
>
As I said earlier, PL/Java _should_ dynamically adapt to how the 
PostgreSQL binary is compiled. But considering the error you get, it 
would be of great value if you could verify what the setting is, and if 
the result is different if PostgreSQL is compiled differently.

Regards,
Thomas Hallgren






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

* [Pljava-dev] ResultSet from trigger screwy with timestamp type
@ 2005-09-02 20:55  
  0 siblings, 0 replies; 5+ messages in thread

From:  @ 2005-09-02 20:55 UTC (permalink / raw)


Thomas:
It appears that the error I am getting is isolated to when postgresql is compiled with the 'integer_datetimes' option (i.e. integer_datetimes = on).  When I recompiled postgresql without integer_datetimes (leaving out '--enable-integer-datetimes' ) the date returned from the ResultSet method 'getTimestamp()' works fine.

Thanks in advance
John Burtenshaw




-----Original Message-----
From: pljava-dev-bounces at gborg.postgresql.org on behalf of Thomas Hallgren
Sent: Fri 9/2/2005 11:31 AM
To: Burtenshaw, John J.
Cc: pljava-dev at gborg.postgresql.org
Subject: Re: [Pljava-dev] ResultSet from trigger screwy with timestamp type
 
Burtenshaw, John J. wrote:

>
> Thomas:
> Thanks for your reply.  Sorry for the confustion with gcj.  I am using 
> the following 'binary' from the pljava home site:
>
> pljava-i686-pc-linux-gnu-pg8.0-1.1.0.tar.gz
>
> I believe it is PLJava 1.1.  I am also using Postgresql 8.0.3.  Is 
> there a way of determining if the debian package of postgresql that I 
> have installed is compiled with the integer/timestamp support?  I'm 
> guessing that we want integer/timestamp support for PLjava to work 
> properly.
>
As I said earlier, PL/Java _should_ dynamically adapt to how the 
PostgreSQL binary is compiled. But considering the error you get, it 
would be of great value if you could verify what the setting is, and if 
the result is different if PostgreSQL is compiled differently.

Regards,
Thomas Hallgren


_______________________________________________
Pljava-dev mailing list
Pljava-dev at gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/pljava-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050902/d3b5af38/attachment.html;



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


end of thread, other threads:[~2005-09-02 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-31 15:19 [Pljava-dev] ResultSet from trigger screwy with timestamp type 
2005-09-01 05:59 ` 
2005-09-02 13:40 [Pljava-dev] ResultSet from trigger screwy with timestamp type 
2005-09-02 15:31 ` 
2005-09-02 20:55 [Pljava-dev] ResultSet from trigger screwy with timestamp type 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox