Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views

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, pgsql-bugs(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views
Date: 2004-07-04 19:16:56
Message-ID: Pine.BSO.4.56.0407041330180.26773@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc pgsql-patches pgsql-sql

On Sat, 3 Jul 2004, Dario V. Fassi wrote:

> In the sample adjunct, you can see that error arise at the time when the
> view's sql text is parsed and saved in database catalog.
> Then generic NUMERIC type is forced for every calculated column without
> regard or precision.
> And at execute time the f2 column has varying type decimals (in row 2
> you can see 4 decimals and in other rows has 3 decimals), this is not a
> behavior , this is an ERROR.

It isn't clear that an operation like + should retain the same size
restrictions as it's arguments. Consider adding two numeric(6,2) values
of 9999.99, how do you handle the overflow? Your other arguments about the
sizing of derived columns may make sense for your application, but it is
unlikely that they make sense for all users. Note that you can put a cast
into your view definition like so:

CREATER VIEW v AS SELECT (a+b)::numeric(6,2) FROM tab;

Kris Jurka

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-04 20:58:17 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views
Previous Message Dario V. Fassi 2004-07-03 18:39:59 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-04 20:58:17 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views
Previous Message Dario V. Fassi 2004-07-03 18:39:59 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-07-04 20:23:25 Re: [HACKERS] Compile failure in plperl
Previous Message Andrew Dunstan 2004-07-04 17:56:26 plperl spi_exec_query patch

Browse pgsql-sql by date

  From Date Subject
Next Message Dario V. Fassi 2004-07-04 20:58:17 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views
Previous Message Dario V. Fassi 2004-07-03 18:39:59 Re: [JDBC] Error in DatabaseMetaData.getColumns() with Views