MDEV-40486 Length check for vector fields in CREATE TABLE ... SELECT#5443
MDEV-40486 Length check for vector fields in CREATE TABLE ... SELECT#5443mariadb-YuchenPei wants to merge 1 commit into
Conversation
|
|
|
claude: Code Review: MDEV-40486 — Length check for vector fields in
|
The changes of MDEV-39558 2b65294 added length check assertion in Field_varstring constructors, and length check in type inference for SELECT set operations, to emit errors before reaching the assertions. That change caused an error to turn into an assertion failure in a separate path, when the length limit violation is not detected before tripping the assertion. So in this patch we fix it by adding an earlier length check in that path. Also use max_char_length() instead of max_length. This is a more accurate length of characters. And add handling of empty string edge case. Added testcases accordingly.
3b1915b to
4e97c43
Compare
|
claude: Code Review: MDEV-40486 (revised) — Length check for vector fields in
|
|
re claude comment
This is actually covered, for example, in this testcase: Before the change from max_length to max_char_length() this would fail with ER_TOO_BIG_FIELDLENGTH, because the max_length of VARCHAR(16383) is 65532 which results in 131064 max length for the vector, exceeding its limit. After the change it uses max_char_length() which is, well, 16383 and is correct.
I am not sure how this is possible, so I asked claude to come up with a testcase and it came up with a wrong one. After more back and forth it conceded this point is invalid. The second round review is done after that, but somehow clauded decided to make the same comment again |
The changes of MDEV-39558 2b65294 added length check assertion in Field_varstring constructors, and length check in type inference for SELECT set operations, to emit errors before reaching the assertions.
That change caused an error to turn into an assertion failure in a separate path, when the length limit violation is not detected before tripping the assertion. So in this patch we fix it by adding an earlier length check in that path.