You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrey Khitrin (Jira)" <ji...@apache.org> on 2022/12/30 09:06:00 UTC

[jira] [Created] (IGNITE-18492) SQL: Inconsistent behavior of LENGTH limit for CHAR data type

Andrey Khitrin created IGNITE-18492:
---------------------------------------

             Summary: SQL: Inconsistent behavior of LENGTH limit for CHAR data type
                 Key: IGNITE-18492
                 URL: https://issues.apache.org/jira/browse/IGNITE-18492
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 3.0.0-beta1
            Reporter: Andrey Khitrin


When I create a table with {{CHAR(length)}} column, it's still possible to insert character values with length greater than given limit.
{code:sql}
sql-cli> create table xx (pk int primary key, f1 char(5));
Updated 0 rows.
sql-cli> insert into xx values (1, 'abcdefgh');
Updated 1 rows.
sql-cli> select * from xx;
╔════╤══════════╗
║ PK │ F1       ║
╠════╪══════════╣
║ 1  │ abcdefgh ║
╚════╧══════════╝
{code}
In other hand, length limit is applied when I insert non-char value that's casted into {{CHAR}} implicitly. With the same table as above:
{code:sql}
sql-cli> insert into xx values (2, 1234567);
Updated 1 rows.
sql-cli> select * from xx;
╔════╤══════════╗
║ PK │ F1       ║
╠════╪══════════╣
║ 2  │ 12345    ║
╟────┼──────────╢
║ 1  │ abcdefgh ║
╚════╧══════════╝
{code}
Behavior should be consistent: ether strip both values down to the given length limit, or deny to insert too long values in both cases (like it's done in other DBs, like postgresql).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)