Re: JBoss w/int8 primary keys in postgres ...

From: João Ribeiro <jp(at)mobicomp(dot)com>
To: James Robinson <jlrobins(at)socialserve(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JBoss w/int8 primary keys in postgres ...
Date: 2003-09-12 10:16:11
Message-ID: 3F619CEB.6090406@mobicomp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

As i told before if you have an app already in production state i
recomend you to do as we did:
patch the setLong and setBigDecimal methods and compile your own
version of postgres JDBC driver.

It's very easy to be done. Here is an example:

The orginal look like:

public void setBigDecimal(int parameterIndex, BigDecimal x) throws
SQLException
{
if (x == null)
setNull(parameterIndex, Types.OTHER);
else
set(parameterIndex, x.toString());
}

public void setLong(int parameterIndex, long x) throws SQLException {
set(parameterIndex, (new Long(x)).toString());
}

and we changed de set(...) to setString(..) and its look like:

public void setBigDecimal(int parameterIndex, BigDecimal x) throws
SQLException {
if (x == null)
setNull(parameterIndex, Types.OTHER);
else
setString(parameterIndex, x.toString());
}

public void setLong(int parameterIndex, long x) throws SQLException {
setString(parameterIndex, (new Long(x)).toString());

}

With this change when we use the setBigdecimal or the setLong in a
query the value passed will be evaluated and the will be correctly
used.

This has been working in a production database for more than a year.

Regards.
João Paulo Ribeiro

James Robinson wrote:

>
> On Wednesday, September 10, 2003, at 11:42 PM, Tom Lane wrote:
>
>> Once upon a time it seemed that was where the hot buttons were, but
>> if your hot button is mostly int8, maybe we could fix that by removing
>> the int8-vs-int4 cross-type operators, and not touch the initial typing
>> of integer literals just yet. Does someone want to explore the
>> consequences of trying that?
>>
>
> I would be delighted, sitting on a 59 table production OLTP system,
> all with int8 primary keys and foreign key references out the yin yang.
> Things are running within within our needs currently, but just having
> realized that things could potentially be much better, the desire for
> 'wow, we're doing all of these O(n) searches that we thought were
> log2(n), so this could be so much better than we realized without
> us touching our app logic at all.'
>
> My personal need-to-be-scratched is int8 exclusively. What sort of 'fool'
> would ever have a int2 index :-) ? Probably the same number of 'fools'
> with int8.
>
> James
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/YZzwbwM7R+C+9B0RAjZfAKCwHXfajcKndw8mDf31CPzpm0BinwCeLu2S
PvX0B9KY5zfwiVJFi29MRD8=
=3Jay
-----END PGP SIGNATURE-----

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kevin Schroeder 2003-09-12 16:50:20 JDBC Streaming large objects
Previous Message Barry Lind 2003-09-11 16:06:38 Re: German Umlauts and JDBC