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

Database object names case inconsisten between SQL and KV API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-alpha3
    • 3.0.0-alpha4
    • sql
    • Docs Required, Release Notes Required

    Description

      Current naming of the database object is not clear for everyone.

      Current behavior
      CREATE TABLE mytable(id INT, val INT); -> creates PUBLIC.MYTABLE (ID, VAL)
      ignite.tables().table("public.mytable"); -> fails with table not found
      ignite.tables().table("PUBLIC.MYTABLE "); -> returns PUBLIC.MYTABLE
      CREATE TABLE \"MyTable\" (id INT, val INT); -> creates PUBLIC.MyTable(ID, VAL)
      ignite.tables().table("PUBLIC.MyTable"); -> returns PUBLIC.MyTable

      Tuple / column behavior:
      CREATE TABLE MyTable (id INT, \"Id\" INT, val INT); -> creates PUBLIC.MYTABLE (ID, Id, VAL)
      tbl.get().value("id") -> fails with error: column not found
      tbl.get().value("ID") -> returns ID column's value
      tbl.get().value("Id") -> returns Id column's value

      Proposed Fixes

      1. Use case insensitive collation to compare and lookup database object
      e.g.
      CREATE TABLE MyTable (id INT, val INT); -> creates PUBLIC.MYTABLE (ID, VAL)
      ignite.tables().table("public.mytable"); -> returns PUBLIC.MYTABLE
      CREATE TABLE \"MyTable\" (id INT, val INT); -> fails with error: PUBLIC.MYTABLE already exists,

      Tuple / column behavior:
      CREATE TABLE MyTable (id INT, \"Id\" INT, val INT); -> fails with error: duplicate column name: ID
      tbl.get().value("id") -> returns ID column's value
      tbl.get().value("Id") -> returns ID column's value

      2. Case sensitive collation for DB object names and parse string argument of the name passed through API
      Use quotation for string values by API
      CREATE TABLE MyTable (id INT, val INT); -> creates PUBLIC.MYTABLE
      ignite.tables().table("public.mytable"); -> returns PUBLIC.MYTABLE
      CREATE TABLE \"MyTable\" (id INT, val INT); -> creates PUBLIC.MyTable
      ignite.tables().table("public.\"MyTable\""); -> returns PUBLIC.MyTable

      Tuple / column behavior:
      CREATE TABLE MyTable (id INT, \"Id\" INT, val INT); -> creates PUBLIC.MYTABLE (ID, Id, VAL)
      Tuple tuple = ...
      tuple.value("id") -> returns ID column's value
      tuple.value("Id") -> returns ID column's value
      tuple.value("\"Id\"") -> returns Id column's value

      Attachments

        Issue Links

          Activity

            People

              tledkov-gridgain Taras Ledkov
              tledkov-gridgain Taras Ledkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m