You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Lukas Eder (Jira)" <ji...@apache.org> on 2021/01/26 15:54:00 UTC

[jira] [Created] (IGNITE-14066) JDBC DatabaseMetaData::getColumns reports REAL column type as FLOAT

Lukas Eder created IGNITE-14066:
-----------------------------------

             Summary: JDBC DatabaseMetaData::getColumns reports REAL column type as FLOAT
                 Key: IGNITE-14066
                 URL: https://issues.apache.org/jira/browse/IGNITE-14066
             Project: Ignite
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.9.1
            Reporter: Lukas Eder


Create a table containing a REAL column:
{code:java}
create table t (i int primary key, r real);{code}
Now read the meta data from DatabaseMetaData::getColumns:
{code:java}
try (ResultSet rs = c.getMetaData().getColumns(null, "PUBLIC", "T", null)) {
  while (rs.next())
    System.out.println(rs.getString("6"));
}{code}
The reported type name is FLOAT, not REAL. The documentation lists no such type, although it does say that REAL is mapped to Java/JDBC "float": [https://ignite.apache.org/docs/latest/sql-reference/data-types#real]

JDBC's java.sql.Types class doesn't specify the precision of each of these types, but the SQL standard <approximate numeric type> definition specifies REAL as "single precision" and DOUBLE (PRECISION) as "double precision", whereas FLOAT can be used with an explicit precision, e.g. FLOAT(x).

This is particularly problematic because if I create the table with an actual "FLOAT" type (which isn't documented):
{code:java}
create table t (i int primary key, r float);{code}
Then the JDBC driver reports DOUBLE for the above program. This makes sense according to the SQL standard and also according to my experience with most other RDBMS. A FLOAT type in SQL is really a Java double, not a Java float.

So, in my opinion, JDBC should report REAL, not FLOAT.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)