Re: Error in DatabaseMetaData.getColumns() with Views

From: Kris Jurka <books(at)ejurka(dot)com>
To: software(at)sistemat(dot)com(dot)ar
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error in DatabaseMetaData.getColumns() with Views
Date: 2004-07-03 08:45:45
Message-ID: Pine.BSO.4.56.0407030343090.19721@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc pgsql-patches pgsql-sql

On Fri, 2 Jul 2004, Dario Fassi wrote:

> Hi, I wish 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 )
>

The problem is that f1+f2 does not retain the numeric(6,3) size
restriction, but turns into an unbounded plain "numeric" datatype. So
when retrieving this data the precision/scale are unavailable and the
unreasonable values you see are returned. We could return NULL instead,
but I'm not sure that would be much more helpful if the client is
expecting real values. Any other ideas?

Kris Jurka

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gaetano Mendola 2004-07-03 14:51:50 Re: BUG #1186: Broken Index?
Previous Message Dario Fassi 2004-07-03 01:14:54 Error in DatabaseMetaData.getColumns() with Views

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-03 17:06:55 Re: Error in DatabaseMetaData.getColumns() with Views
Previous Message Dario Fassi 2004-07-03 01:14:54 Error in DatabaseMetaData.getColumns() with Views

Browse pgsql-patches by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-03 17:06:55 Re: Error in DatabaseMetaData.getColumns() with Views
Previous Message Gavin Sherry 2004-07-03 06:47:33 Example for create function using argument names

Browse pgsql-sql by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-03 17:06:55 Re: Error in DatabaseMetaData.getColumns() with Views
Previous Message Dario Fassi 2004-07-03 01:14:54 Error in DatabaseMetaData.getColumns() with Views