Re: Error in DatabaseMetaData TableColumn lenght.dec information

Lists: pgsql-jdbc
From: "Dario V(dot) Fassi" <software(at)sistemat(dot)com(dot)ar>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Error in DatabaseMetaData TableColumn lenght.dec information
Date: 2004-07-03 01:10:04
Message-ID: 40E6076C.30105@sistemat.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi, I whish to report a erroneous information returned by
DatabaseMetaData.getColumns() method.

This happens with ResultSet's column (7) COLUMN_SIZE and (9)
DECIMAL_DIGITS ,
when DatabaseMetaData.getColumns() inform about a VIEW with columns
formed with :
coalesce , case or numeric operations over DECIMAL fields.

Suppose

CREATE TABLE A ( f1 DEC(6,3), f2 dec(6,3) );
CREATE VIEW B as ( select ( f1 + f2 ) as f from a;

Then DatabaseMetaData.getColumns() returns:

VIEW B
F NUMERIC( 65535 , -65531 )

This error its very molest because if you are trying to do
CodeGeneration tools from DatabaseMetaData , you get lost.

Any suggestion will be appreciated.
Best regards,

Dario V. Fassi

SISTEMATICA ingenieria de software srl
<http://www.sistemat.com.ar>Ituzaingo 1628 (2000) Rosario, Santa Fe,
Argentina.
Tel / Fax: +54 (341) 485.1432 / 485.1353


From: Kris Jurka <books(at)ejurka(dot)com>
To: "Dario V(dot) Fassi" <software(at)sistemat(dot)com(dot)ar>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error in DatabaseMetaData TableColumn lenght.dec
Date: 2004-07-09 23:53:11
Message-ID: Pine.BSO.4.56.0407091852010.17806@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Fri, 2 Jul 2004, Dario V. Fassi wrote:

> Hi, I whish to report a erroneous information returned by
> DatabaseMetaData.getColumns() method.
>
> Suppose
>
> CREATE TABLE A ( f1 DEC(6,3), f2 dec(6,3) );
> CREATE VIEW B as ( select ( f1 + f2 ) as f from a;
>
> Then DatabaseMetaData.getColumns() returns:
>
> VIEW B
> F NUMERIC( 65535 , -65531 )
>

I've modified the cvs version of the driver to return numeric(1000,1000)
which is the maximum precision and scale you are allowed to define. A
more complete solution is outside the realm of the JDBC driver.

Kris Jurka


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: "Dario V(dot) Fassi" <software(at)sistemat(dot)com(dot)ar>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error in DatabaseMetaData TableColumn lenght.dec
Date: 2004-07-10 17:07:06
Message-ID: 13576.1089479226@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka <books(at)ejurka(dot)com> writes:
> I've modified the cvs version of the driver to return numeric(1000,1000)
> which is the maximum precision and scale you are allowed to define. A
> more complete solution is outside the realm of the JDBC driver.

That doesn't sound like a usable answer at all. A client that believes
this result will think that the value cannot contain any digits to the
left of the decimal point --- which is certainly not so.

Does the JDBC spec allow you to return NULL for these entries? That's
what we recently fixed the information_schema views to do for
unconstrained numeric columns.

regards, tom lane


From: "Dario V(dot) Fassi" <software(at)sistemat(dot)com(dot)ar>
To: Kris Jurka <books(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error in DatabaseMetaData TableColumn lenght.dec information
Date: 2004-07-10 17:25:21
Message-ID: 40F02681.2010209@sistemat.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka wrote:

>On Fri, 2 Jul 2004, Dario V. Fassi wrote:
>
>
>
>>Hi, I whish to report a erroneous information returned by
>>DatabaseMetaData.getColumns() method.
>>
>>Suppose
>>
>>CREATE TABLE A ( f1 DEC(6,3), f2 dec(6,3) );
>>CREATE VIEW B as ( select ( f1 + f2 ) as f from a;
>>
>>Then DatabaseMetaData.getColumns() returns:
>>
>>VIEW B
>> F NUMERIC( 65535 , -65531 )
>>
>>
>>
>
>I've modified the cvs version of the driver to return numeric(1000,1000)
>which is the maximum precision and scale you are allowed to define. A
>more complete solution is outside the realm of the JDBC driver.
>
>Kris Jurka
>
>
Kris,

A return value of numeric(1000,1000) , is far better than
numeric(65535,-65531) , but this mean a number with all the presicion in
the fractional part and is not very usefull.

Why not a more login value like "Numeric(100,50)" , yet oversized
but more appropiate.
Can you imagine a number with 1000 digit's presicion, it's impractical
and undisplayable.

Dario Fassi.


From: Kris Jurka <books(at)ejurka(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dario V(dot) Fassi" <software(at)sistemat(dot)com(dot)ar>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error in DatabaseMetaData TableColumn lenght.dec
Date: 2004-07-11 05:13:14
Message-ID: Pine.BSO.4.56.0407110011060.24102@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Sat, 10 Jul 2004, Tom Lane wrote:

> Kris Jurka <books(at)ejurka(dot)com> writes:
> > I've modified the cvs version of the driver to return numeric(1000,1000)
> > which is the maximum precision and scale you are allowed to define. A
> > more complete solution is outside the realm of the JDBC driver.
>
> That doesn't sound like a usable answer at all. A client that believes
> this result will think that the value cannot contain any digits to the
> left of the decimal point --- which is certainly not so.

I blew this one. For some reason I was thinking 1000, 1000 was 1000 to
the left and right of the decimal.

> Does the JDBC spec allow you to return NULL for these entries? That's
> what we recently fixed the information_schema views to do for
> unconstrained numeric columns.

No, the method returns "int" which is a primitive type and therefore can't
be null. Maybe -1? I'm not sure what the best answer is.

Kris Jurka