pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Error in DatabaseMetaData TableColumn lenght.dec  information
5+ messages / 3 participants
[nested] [flat]

* Error in DatabaseMetaData TableColumn lenght.dec  information
@ 2004-07-03 01:10  Dario V. Fassi <software@sistemat.com.ar>
  0 siblings, 1 reply; 5+ messages in thread

From: Dario V. Fassi @ 2004-07-03 01:10 UTC (permalink / raw)
  To: 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

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Error in DatabaseMetaData TableColumn lenght.dec
@ 2004-07-09 23:53  Kris Jurka <books@ejurka.com>
  parent: Dario V. Fassi <software@sistemat.com.ar>
  0 siblings, 2 replies; 5+ messages in thread

From: Kris Jurka @ 2004-07-09 23:53 UTC (permalink / raw)
  To: Dario V. Fassi <software@sistemat.com.ar>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Error in DatabaseMetaData TableColumn lenght.dec
@ 2004-07-10 17:07  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Kris Jurka <books@ejurka.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2004-07-10 17:07 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: Dario V. Fassi <software@sistemat.com.ar>; pgsql-jdbc

Kris Jurka <books@ejurka.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Error in DatabaseMetaData TableColumn lenght.dec  information
@ 2004-07-10 17:25  Dario V. Fassi <software@sistemat.com.ar>
  parent: Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Dario V. Fassi @ 2004-07-10 17:25 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; 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.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Error in DatabaseMetaData TableColumn lenght.dec
@ 2004-07-11 05:13  Kris Jurka <books@ejurka.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Kris Jurka @ 2004-07-11 05:13 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dario V. Fassi <software@sistemat.com.ar>; pgsql-jdbc



On Sat, 10 Jul 2004, Tom Lane wrote:

> Kris Jurka <books@ejurka.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2004-07-11 05:13 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-03 01:10 Error in DatabaseMetaData TableColumn lenght.dec  information Dario V. Fassi <software@sistemat.com.ar>
2004-07-09 23:53 ` Re: Error in DatabaseMetaData TableColumn lenght.dec Kris Jurka <books@ejurka.com>
2004-07-10 17:07   ` Re: Error in DatabaseMetaData TableColumn lenght.dec Tom Lane <tgl@sss.pgh.pa.us>
2004-07-11 05:13     ` Re: Error in DatabaseMetaData TableColumn lenght.dec Kris Jurka <books@ejurka.com>
2004-07-10 17:25   ` Dario V. Fassi <software@sistemat.com.ar>

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