Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARRAY<VARCHAR(n)> array elements have limits counter to what is defined #45817

Open
digitalpoetry opened this issue May 17, 2024 · 2 comments
Open
Labels
type/bug Something isn't working

Comments

@digitalpoetry
Copy link

Steps to reproduce the behavior (Required)

CREATE TABLE array_field (
    id BIGINT NOT NULL AUTO_INCREMENT,
    a ARRAY<VARCHAR(10)> COMMENT 'An array field of VARCHAR(10) elements'
);

INSERT INTO array_field (a) VALUES (["1234567890"]);
-- Query OK, as expected

INSERT INTO array_field (a) VALUES (["12345678901234"]);
-- Query OK, not expected because the string length is 14

INSERT INTO array_field (a) VALUES (["123456789012345"]);
-- ERROR 1064 (HY000): starrocks.svc.cluster.local: string length(15) > limit(14), string: 123456789012345

Expected behavior (Required)

I expect the elements of the array to be of type VARCHAR(10). An error is expected when elements of length >10 are attempted to be inserted.

Real behavior (Required)

Elements with lengths up to 14 can be inserted. The error message where strings of length >14 also seem to imply that the element limit is 14.

StarRocks version (Required)

3.2.3-a40e2f8

@digitalpoetry digitalpoetry added the type/bug Something isn't working label May 17, 2024
@kangkaisen
Copy link
Collaborator

Hi, what your mean is we should optimize this error message?

@digitalpoetry
Copy link
Author

The array element type is VARCHAR(10). I assume 10 is 10 bytes as per this do (https://docs.starrocks.io/docs/faq/Others/#is-the-length-of-string-defined-by-mysql-the-same-as-that-defined-by-starrocks). Can you please confirm the units here? I wouldn’t expect 10 bytes to fit 14 characters though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants