pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aleksey Demakov <avd@gcom.ru>
To: Peter T Mount <peter@retep.org.uk>
Cc: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] JDBC date problem
Date: 19 Oct 1998 15:13:05 +0700
Message-ID: <871zo5dl65.fsf@avd.garsib.ru> (raw)
References: <Pine.LNX.3.96.981019063722.31130c-100000@maidast.retep.org.uk>

Peter T Mount <peter@retep.org.uk> writes:
> 
> > That is, if the column to contain the row creation date is of type
> > DATETIME, just use now() instead of a ? and a setDate.
> > 
> > INSERT INTO my_table
> >   (creation, other_field1, other_field2, other_field3)
> > VALUES
> >   ('now', ?, ?, ?);
> > 
> > Personally, I do this by defining the creation column as a NOT NULL and
> > giving it a default (There's a bit of a trick here, because you have to use
> > a function, or 'now' will be interpreted as the time of the creation of the
> > table, so I define an SQL function which returns 'now'::DATETIME). This
> > enables me to use a statement like
> > 
> > INSERT INTO my_table
> >   (other_field1, other_field2, other_field3)
> > VALUES
> >   (?,?,?);
> > 
> > And not bother myself about the creation dates (which are automatic).
> 
> This is a valid point, and for his case, I'd agree with you.

Indeed, in my case this is much better solution. Many thanks to Herouth.

> The Date problem is going to be with us as long as people are still using
> pre 1.1.6 JDK's.

Not quite. Also as long as people are using post 1.1.6 JDK's with the
6.3.2 driver.

> I did think of making the driver sence if the bug is present, and then to
> account for it, but decided against it, on the grounds of performance.

As for me it's ok.

-- 
Aleksey Demakov
avd@gcom.ru



view thread (12+ messages)  latest in thread

Message-ID: <871zo5dl65.fsf@avd.garsib.ru>
Permalink:  ../871zo5dl65.fsf@avd.garsib.ru/
Also on:    postgresql.org/message-id/871zo5dl65.fsf@avd.garsib.ru

 · 

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: avd@gcom.ru, peter@retep.org.uk, herouth@oumail.openu.ac.il
  Subject: Re: [INTERFACES] JDBC date problem
  In-Reply-To: <871zo5dl65.fsf@avd.garsib.ru>

* 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