From: Tjioe Ai Xin <xinxincute@gmail.com>
To: pgsql-jdbc@postgresql.org
To: Oliver Jowett <oliver@opencloud.com>
To: Dave Cramer <pg@fastcrypt.com>
To: Kris Jurka <books@ejurka.com>
Subject: Re: Can PostgreSQL do data type automated casting in
Date: Fri, 25 Nov 2005 14:03:15 +0700
Message-ID: <200511251403.15562.xinxincute@gmail.com> (raw)
In-Reply-To: <43862E81.3070308@opencloud.com>
References: <200511211718.26679.xinxincute@gmail.com>
<6022BCB2-7A1B-47A2-AC85-CDBB7CBD127C@fastcrypt.com>
<43862E81.3070308@opencloud.com>
Dear all,
Does it mean in the future PostgreSQL JDBC Driver will support automated casting?
So I don't have to write my code again in order to customize for new driver?
Thanks in advance.
Xin Xin
--------------------------------------------------------------------
On Friday 25 November 2005 04:20, Oliver Jowett wrote:
> Dave Cramer wrote:
> > You're on fairly shaky ground using "allowed by the spec" as
> > justification.
>
> Why's that? Are we no longer trying to write a spec-compliant driver?
>
> > I'm thinking there are far more instances where people
> > expect Oid unspecified to work than
> > instances where they are going to change the type of the IN parameter
> > in the same statement.
>
> Sure, but I'd rather not have an option that makes the driver break
> unexpectedly. Given that we can have both unspecified string types AND a
> fix for the changing-type problem, why do you *not* want to do that?
>
> If you want a more "real world" example, how about something like this:
>
> >> ArrayList toInsert = new ArrayList();
> >> toInsert.add(new Integer(42));
> >> toInsert.add(new Date());
> >> toInsert.add("test string");
> >> // ...
> >> PreparedStatement ps = conn.prepareStatement("INSERT INTO sometexttable(sometextcolumn) VALUES (CAST (? AS TEXT))");
> >> for (Iterator i = toInsert.iterator(); i.hasNext(); ) {
> >> ps.setObject(1, i.next());
> >> ps.executeUpdate();
> >> }
>
> Test cases are not meant to be real-world examples, they're test code.
> Use your imagination!
>
> > Given that the default behaviour adheres to the spec, I'm not too
> > worried about the case below failing under these specific
> > circumstances. I presume it passes with the 8.0,8.1 behaviour.
>
> It does.
>
> The code I have committed to CVS HEAD deals with the
> changing-parameter-type case correctly even with stringtype=unspecified,
> anyway. Can you please try it out and see if you have any problems with it?
>
> Otherwise, as far as I'm concerned I'm done with this -- if people don't
> want to change their (arguably broken) apps, they have an escape hatch
> they can enable explicitly or via compatible=7.4.. IMO we don't need to
> do anything more.
>
> -O
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: xinxincute@gmail.com, oliver@opencloud.com, pg@fastcrypt.com, books@ejurka.com
Subject: Re: Can PostgreSQL do data type automated casting in
In-Reply-To: <200511251403.15562.xinxincute@gmail.com>
References: <200511211718.26679.xinxincute@gmail.com> <6022BCB2-7A1B-47A2-AC85-CDBB7CBD127C@fastcrypt.com> <43862E81.3070308@opencloud.com> <200511251403.15562.xinxincute@gmail.com>
* 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