Details
Description
When I create a table with CHAR(length) column, it's still possible to insert character values with length greater than given limit.
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 ║ ╚════╧══════════╝
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:
sql-cli> insert into xx values (2, 1234567); Updated 1 rows. sql-cli> select * from xx; ╔════╤══════════╗ ║ PK │ F1 ║ ╠════╪══════════╣ ║ 2 │ 12345 ║ ╟────┼──────────╢ ║ 1 │ abcdefgh ║ ╚════╧══════════╝
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).
Dynamic params can be processed to, check IgniteSqlValidator#inferDynamicParamType
NOTE
VARCHAR is also affected
(this note was added so that the ticket would be included in the search for the keyword VARCHAR)
Attachments
Issue Links
- Discovered while testing
-
IGNITE-21953 Cover SQL E021-01(Character string types. CHARACTER data type) feature by tests
- Resolved
- links to