Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-14066

JDBC DatabaseMetaData::getColumns reports REAL column type as FLOAT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.9.1
    • None
    • jdbc
    • None
    • Docs Required, Release Notes Required

    Description

      Create a table containing a REAL column:

      create table t (i int primary key, r real);

      Now read the meta data from DatabaseMetaData::getColumns:

      try (ResultSet rs = c.getMetaData().getColumns(null, "PUBLIC", "T", null)) {
        while (rs.next())
          System.out.println(rs.getString("6"));
      }

      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.

      This is particularly problematic because if I create the table with an actual "FLOAT" type (which isn't documented):

      create table t (i int primary key, r float);

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lukas.eder Lukas Eder
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: