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

Create index with nullable parts gets them not nullable #7614

Closed
Mons opened this issue Aug 26, 2022 · 0 comments · Fixed by #7622
Closed

Create index with nullable parts gets them not nullable #7614

Mons opened this issue Aug 26, 2022 · 0 comments · Fixed by #7622
Assignees
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working

Comments

@Mons
Copy link
Contributor

Mons commented Aug 26, 2022

Consider the following snippet

box.cfg{}
box.schema.space.create('test', {if_not_exists = true})
box.space.test:format({
    {name = 'id', type = 'number'},
    {name = 'data', type = 'string', is_nullable = true},
})
box.space.test:create_index('primary',{if_not_exists = true})

box.space.test:create_index('sec1', {
    parts = { 2, 'string' },
    if_not_exists = true,
})

box.space.test:create_index('sec2', {
    parts = { 1, 'number', 2, 'string' },
    if_not_exists = true,
})

box.space.test:create_index('sec3', {
    parts = { 'id', 'data' },
    if_not_exists = true,
})

print("first part", box.space.test.index.sec1.parts[1].is_nullable and "correct" or "not correct")
print("second part", box.space.test.index.sec2.parts[2].is_nullable and "correct" or "not correct")
print("second part, named", box.space.test.index.sec3.parts[2].is_nullable and "correct" or "not correct")

require "console".start()
os.exit()

output for 2.10 would be:

first part	correct
second part	not correct
second part, named	correct

We have a space with a nullable field.
If we set this field in composite index, then in some cases in the index field will be not nullable.
This is a regression, in 1.10 everything is ok

@Mons Mons added the bug Something isn't working label Aug 26, 2022
@alyapunov alyapunov added the 3sp label Aug 26, 2022
nshy added a commit to nshy/tarantool that referenced this issue Aug 29, 2022
If index parts are specified using old syntax like:

	parts = {1, 'number', 2, 'string'},

then (except if parts count is 1) index options set in space format
are not taken into account. Solution is to continue after parsing 1.6.0
style parts so to use code that check format options.

Closes tarantool#7614

NO_DOC=bugfix
nshy added a commit to nshy/tarantool that referenced this issue Aug 30, 2022
If index parts are specified using old syntax like:

	parts = {1, 'number', 2, 'string'},

then (except if parts count is 1) index options set in space format
are not taken into account. Solution is to continue after parsing 1.6.0
style parts so to use code that check format options.

Closes tarantool#7614

NO_DOC=bugfix
@locker locker added the 2.10 Target is 2.10 and all newer release/master branches label Aug 31, 2022
@kyukhin kyukhin removed the 3sp label Aug 31, 2022
locker pushed a commit that referenced this issue Aug 31, 2022
If index parts are specified using old syntax like:

	parts = {1, 'number', 2, 'string'},

then (except if parts count is 1) index options set in space format
are not taken into account. Solution is to continue after parsing 1.6.0
style parts so to use code that check format options.

Closes #7614

NO_DOC=bugfix
locker pushed a commit that referenced this issue Aug 31, 2022
If index parts are specified using old syntax like:

	parts = {1, 'number', 2, 'string'},

then (except if parts count is 1) index options set in space format
are not taken into account. Solution is to continue after parsing 1.6.0
style parts so to use code that check format options.

Closes #7614

NO_DOC=bugfix

(cherry picked from commit 91ba0a5)
mkokryashkin pushed a commit to mkokryashkin/tarantool that referenced this issue Sep 9, 2022
If index parts are specified using old syntax like:

	parts = {1, 'number', 2, 'string'},

then (except if parts count is 1) index options set in space format
are not taken into account. Solution is to continue after parsing 1.6.0
style parts so to use code that check format options.

Closes tarantool#7614

NO_DOC=bugfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Target is 2.10 and all newer release/master branches bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants