pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ken Kachnowich <khkachn@toad.net>
To: Cedar Cox <cedarc@visionforisrael.com>
To: Postgres interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: RE: datetime fix
Date: Tue, 24 Oct 2000 19:09:45 -0400
Message-ID: <39F616B9.B228F44C@toad.net> (raw)
References: <Pine.LNX.4.21.0010241158520.3609-100000@nanu.visionforisrael.com>

I do a PreparedStatement and setTimestamp() to do the select.
The Timestamp value is converted into a String in the JDBC code.

This may not be a JDBC problem. I can not select by a datetime field
in psql all the time. It seems if the milliseconds are below some
value it works and if above not. .62 worked for me but .71 did not.
I did a copy and paste of the datetime value to get it right:

select * from table_a;

| fld1
---------------------------
|2000-10-24 10:15:01.71-04|

select * from table_a where fld1 = '2000-10-24 10:15:01.71';

0 records found 

I had to make a change to the JDBC code to even get the .62 select to
work. The Timestamp toString() method gives a 3 digit millisecond
value and Postgres seems to not want the leading zero (ie: .62 viz
.062).

I will try these with query=1 in pg_options to get the query.


Ken

Cedar Cox wrote:
> 
> >  - select the datetime field from table A into a Timestamp variable
> >  - Use this Timestamp variable to select the record from table B
> >
> > I get no records found when I do this.
> 
> Interesting thought:  Is a timestamp numeric or string data?  How do you
> specify it in a query?  Do you quote it?
> 
> -Cedar



view thread (11+ messages)  latest in thread

Message-ID: <39F616B9.B228F44C@toad.net>
Permalink:  ../39F616B9.B228F44C@toad.net/
Also on:    postgresql.org/message-id/39F616B9.B228F44C@toad.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: khkachn@toad.net, cedarc@visionforisrael.com
  Subject: Re: RE: datetime fix
  In-Reply-To: <39F616B9.B228F44C@toad.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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