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

Adding a UDT field of type duration doesn't check whether it's allowed #12913

Closed
cvybhu opened this issue Feb 17, 2023 · 5 comments
Closed

Adding a UDT field of type duration doesn't check whether it's allowed #12913

cvybhu opened this issue Feb 17, 2023 · 5 comments

Comments

@cvybhu
Copy link
Contributor

cvybhu commented Feb 17, 2023

Having values of the duration type is not allowed for clustering columns, because duration can't be ordered (is 30 days less than 1 month?).
This is correctly validated when creating a table:

cqlsh:ks> CREATE type type_with_duration (a int, d duration);
cqlsh:ks> CREATE TABLE tab (pk int, ck frozen<type_with_duration>, PRIMARY KEY (pk, ck));
InvalidRequest: Error from server: code=2200 [Invalid query] message="duration type is not supported for PRIMARY KEY part ck"

But when adding a new field to a user defined type, there is no check whether this UDT is used in some clustering key.

cqlsh:ks> CREATE TYPE my_type (a int);
cqlsh:ks> CREATE TABLE tab (pk int, ck frozen<my_type>, PRIMARY KEY (pk, ck));
cqlsh:ks> ALTER TYPE my_type ADD d duration; -- Success, but should fail with an error
@DoronArazii DoronArazii added this to the 5.x milestone Feb 20, 2023
alezzqz added a commit to soft-stech/scylladb that referenced this issue Nov 10, 2023
… clustering key

Having values of the duration type is not allowed for clustering
columns, because duration can't be ordered. This is correctly validated
when creating a table but do not validated when we alter the type.

Fixes scylladb#12913
@denesb
Copy link
Contributor

denesb commented Dec 18, 2023

@cvybhu do we need a backport to 5.4?
5.2 doesn't have UDT permissions, so doesn't need it.

@cvybhu
Copy link
Contributor Author

cvybhu commented Dec 18, 2023

@cvybhu do we need a backport to 5.4?
5.2 doesn't have UDT permissions, so doesn't need it.

Most likely, the bug most likely has been there for a long while.
But I don't work at Scylla anymore, so I won't be able to backport it.

denesb pushed a commit that referenced this issue Dec 18, 2023
… clustering key

Having values of the duration type is not allowed for clustering
columns, because duration can't be ordered. This is correctly validated
when creating a table but do not validated when we alter the type.

Fixes #12913

Closes #16022

(cherry picked from commit bd73536)
denesb pushed a commit that referenced this issue Dec 18, 2023
… clustering key

Having values of the duration type is not allowed for clustering
columns, because duration can't be ordered. This is correctly validated
when creating a table but do not validated when we alter the type.

Fixes #12913

Closes #16022

(cherry picked from commit bd73536)
@denesb
Copy link
Contributor

denesb commented Dec 18, 2023

Backported to 5.4 and 5.2.

denesb pushed a commit that referenced this issue Dec 18, 2023
… clustering key

Having values of the duration type is not allowed for clustering
columns, because duration can't be ordered. This is correctly validated
when creating a table but do not validated when we alter the type.

Fixes #12913

Closes #16022

(cherry picked from commit bd73536)
@denesb
Copy link
Contributor

denesb commented Dec 18, 2023

5.2 backport dequeued, it breaks the build.

@denesb denesb added Backport candidate backport/5.2 Issues that should be backported to 5.2 branch once they'll be fixed labels Dec 18, 2023
denesb pushed a commit that referenced this issue Dec 19, 2023
… clustering key

Having values of the duration type is not allowed for clustering
columns, because duration can't be ordered. This is correctly validated
when creating a table but do not validated when we alter the type.

Fixes #12913

Closes #16022

(cherry picked from commit bd73536)
@denesb
Copy link
Contributor

denesb commented Dec 19, 2023

Re-did 5.2 backport.

@denesb denesb removed Backport candidate backport/5.2 Issues that should be backported to 5.2 branch once they'll be fixed labels Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants