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

Sql. Constant default value is not implemented for UUID data type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • sql

    Description

      In SQL, it's possible to define default values for some columns. These values would be used on insertion when explicit values are omitted. For example:

      sql-cli> create table def_time(key INTEGER not null, val TIME not null default '12:12:12', primary key (key));
      sql-cli> insert into def_time (key) values (1);
      sql-cli> select * from def_time;
      ╔═════╤══════════╗
      ║ KEY │ VAL      ║
      ╠═════╪══════════╣
      ║ 1   │ 12:12:12 ║
      ╚═════╧══════════╝
      

      But it's not true for UUID data type. It's possible to "define" default value for this type, but it's not actually applied as default:

      sql-cli> create table def_uuid(key INTEGER not null, val UUID not null default '4a2f1859-c73b-4eec-a29c-629ec68d8735', primary key (key));
      sql-cli> insert into def_uuid(key) values (1);
      Unknown error
      null
      

      Only explicit UUID values are currently supported:

      sql-cli> insert into def_uuid values (2, '46e438c5-4722-4806-8614-e5aa15b9ded8');
      Updated 1 rows.
      sql-cli> select * from def_uuid;
      ╔═════╤══════════════════════════════════════╗
      ║ KEY │ VAL                                  ║
      ╠═════╪══════════════════════════════════════╣
      ║ 2   │ 46e438c5-4722-4806-8614-e5aa15b9ded8 ║
      ╚═════╧══════════════════════════════════════╝
      

      Found on `06f62ebd7abb76f9c24d171cf03bad26f21436ca`.

      Probably, it's simply a non-implemented-yet feature (as UUID-related epic is not completely finished yet). In that case, feel free to trasnform this ticket from bug into a feature request.

      Attachments

        Issue Links

          Activity

            People

              xtern Pavel Pereslegin
              akhitrin Andrey Khitrin
              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 - 10m
                  10m