From: Sergio Lob <Sergio_Lob@iwaysoftware.com>
To: oliver@opencloud.com
Cc: pgsql-bugs@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Cc: Sergio Lob <sergio_lob@iwaysoftware.com>
Subject: Re: BUG #1523: precision column value returned from getTypeInfo()
Date: Fri, 04 Mar 2005 08:58:20 -0500
Message-ID: <4228697C.6020300@iwaysoftware.com> (raw)
In-Reply-To: <4227C2E7.7030308@opencloud.com>
References: <4227C2E7.7030308@opencloud.com>
Hi Oliver,
The Microsoft ODBC 2.0 SDK guide and reference (Appendix D) contains
a pretty thorough definition of what precision means in relation to
various data types. I have never seen a definition of precision in any
JDBC doc I have read, however.
According to ODBC 2.0 spec definition of precision, "the precision of a
numeric column or parameter refers to the maximum number of digits used
by the data type of the column or parameter. The precision of a
nonnumeric column or parameter generally refers to either the maximum
length or defined length of the column or parameter. The following table
defines the precision for each ODBC SQL data type:
SQL Type Precision
----------- ----------
SQL_CHAR The defined length of
the column or parameter. For
SQL_VARCHAR example, the precision of a
column defined as CHAR(10)
is 10
SQL_LONGVARCHAR The maximum length of the column
or parameter
SQL_DECIMAL The defined number of
digits. For example, the
SQL_NUMERIC precision of a column
defined as NUMERIC(10,3) is 10
SQL_BIT 1
SQL_TINYINT 3
SQL_SMALLINT 5
SQL_INTEGER 10
SQL_BIGINT 19(if signed) or 20
(if unsigned)
SQL_REAL 7
SQL_FLOAT 15
SQL_DOUBLE
SQL_BINARY The defined length of
the column or parameter. For example,
SQL_VARBINARY the precision of a column
defined as BINARY(10) is 10
SQL_LONGVARBINBARY The maximum length of the column or
parameter
SQL_DATE 10 (the number of
characters in yyyy-mm-dd format)
SQL_TIME 8 (the number of
characters in hh:mm:ss format)
SQL_TIMESTAMP The number of
characters in the
"yyyy-mm-dd hh:mm:ss[.f...]" format used by the
timestamp data type. For example, if the timestamp does
not
use seconds of fractional digits, the precision is 16
(the
number of characters in the "yyyy-mm-dd hh:mm"
format). If a timestamp uses thousandths of a second,
the
precision is 23 ("yyyy-mm-dd hh:mm:ss.fff" format)
I have found problems with the answer set of other JDBC methods which
return metadata information as well. For instance, the description of
length values of certain columns in the DatabaseMetadata.getColumns()
method answer set return negative numbers (-4 ?).
This data being crucial to applications that I have written, I have
unforunately had to take PostgresSQL off the list of JDBC data sources
that I can support through my application.
Anyway, I hope I answered your question about precision.
Sergio Lob
oliver@opencloud.com wrote:
>(cc'ing -jdbc)
>
>Sergio Lob wrote:
>
>
>
>>After calling Connection.DatabaseMetaData.getTypeInfo() method, the
>>PRECISION column of the ResultSet seems hardcoded to value 9, which of
>>course in incorrect
>>
>>
>
>Well, it's working as intended in the sense that there is no code to
>support retrieving a real precision value -- it is indeed a hardcoded
>placeholder value. I'm not sure why '9' off the top of my head, perhaps
>making that column NULL would be better? What are the units of this
>value anyway?
>
>If you're willing to do the implementation work to improve this, then
>post a patch to pgsql-jdbc and I can look at applying it.
>
>-O
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: Sergio_Lob@iwaysoftware.com, oliver@opencloud.com, pgsql-bugs@postgresql.org
Subject: Re: BUG #1523: precision column value returned from getTypeInfo()
In-Reply-To: <4228697C.6020300@iwaysoftware.com>
References: <4227C2E7.7030308@opencloud.com> <4228697C.6020300@iwaysoftware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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