Re: Bug: getColumns returns bad data for numeric types in

From: Barry Lind <blind(at)xythos(dot)com>
To: gantzm(at)barcodesolutions(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug: getColumns returns bad data for numeric types in
Date: 2003-02-25 17:00:31
Message-ID: 3E5BA12F.9060501@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Michael,

This has already been fixed. I believe it it in build 109 for 7.3
available for download from the jdbc.postgresql.org website.

thanks,
--Barry

Michael L. Gantz wrote:
>
> The metadata method getColumns is returning bad data for numeric types.
> If I apply the following patch it fixes the problem. Could someone
> confirm this and have whoever tracks this piece of code apply this patch?
>
> Short version :
>
> 2340c2340
> < int attypmod = rs.getInt(8) - VARHDRSZ;
> ---
> > int attypmod = rs.getInt(6) - VARHDRSZ;
>
>
> Context version :
>
> *** AbstractJdbc1DatabaseMetaData.java.old Mon Feb 24 18:04:03 2003
> --- AbstractJdbc1DatabaseMetaData.java Mon Feb 24 18:03:47 2003
> ***************
> *** 2337,2343 ****
> }
> else if (pgType.equals("numeric") ||
> pgType.equals("decimal"))
> {
> ! int attypmod = rs.getInt(8) - VARHDRSZ;
> tuple[6] = Integer.toString( ( attypmod
> >> 16 ) & 0xffff ).getBytes();
> tuple[8] = Integer.toString(attypmod &
> 0xffff).getBytes();
> tuple[9] = "10".getBytes();
> --- 2337,2343 ----
> }
> else if (pgType.equals("numeric") ||
> pgType.equals("decimal"))
> {
> ! int attypmod = rs.getInt(6) - VARHDRSZ;
> tuple[6] = Integer.toString( ( attypmod
> >> 16 ) & 0xffff ).getBytes();
> tuple[8] = Integer.toString(attypmod &
> 0xffff).getBytes();
> tuple[9] = "10".getBytes();
>
>
>
>
>
> Thanks,
> Michael L. Gantz
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Adler 2003-02-26 17:51:59 revised patch for COPY
Previous Message Michael L. Gantz 2003-02-25 14:53:33 Bug: getColumns returns bad data for numeric types in 7.3.2