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
sql: crash on table creation with PRIMARY INDEX and UNIQUE specifiers #3498
Comments
SudoBobo
added a commit
that referenced
this issue
Jul 8, 2018
Now every sqlite struct Index is created with tnt struct index_def inside. This allows us to use tnt index_def in work with sqlite indexes in the same manner as with tnt index and is a step to remove sqlite Index with tnt index. Fields coll_array, coll_id_array, aiColumn, sort_order, aiRowLogEst and zName are removed from Index. All usages of this fields changed to usage of corresponding index_def or index_def->opts fields. index_is_unique(), sql_index_collation() and index_column_count() are removed with calls of index_def corresponding fields. Also there is small change in user-visible behavior: before the patch a statement like CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b)) created only one constraint index (for primary key) and no index for UNIQUE constraint (since it is upon the same columns), neither it is named or non-named constraint. After the patch index will be always created for named constraints. It is a temporary solution. In future it's preferable not to create an index, but to make some record in _constraints space that this named unique constraint implemented with the same index as primary key constraint. Closes: #3369, #3498
SudoBobo
added a commit
that referenced
this issue
Jul 13, 2018
Now every sqlite struct Index is created with tnt struct index_def inside. This allows us to use tnt index_def in work with sqlite indexes in the same manner as with tnt index and is a step to remove sqlite Index with tnt index. Fields coll_array, coll_id_array, aiColumn, sort_order, aiRowLogEst and zName are removed from Index. All usages of this fields changed to usage of corresponding index_def or index_def->opts fields. index_is_unique(), sql_index_collation() and index_column_count() are removed with calls of index_def corresponding fields. Also there is small change in user-visible behavior: before the patch a statement like CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b)) created only one constraint index (for primary key) and no index for UNIQUE constraint (since it is upon the same columns), neither it is named or non-named constraint. After the patch index will be always created for named constraints. It is a temporary solution. In future it's preferable not to create an index, but to make some record in _constraints space that this named unique constraint implemented with the same index as primary key constraint. Closes: #3369, #3498
SudoBobo
added a commit
that referenced
this issue
Jul 13, 2018
Now every sqlite struct Index is created with tnt struct index_def inside. This allows us to use tnt index_def in work with sqlite indexes in the same manner as with tnt index and is a step to remove sqlite Index with tnt index. Fields coll_array, coll_id_array, aiColumn, sort_order, aiRowLogEst and zName are removed from Index. All usages of this fields changed to usage of corresponding index_def or index_def->opts fields. index_is_unique(), sql_index_collation() and index_column_count() are removed with calls of index_def corresponding fields. Also there is small change in behavior: before the patch a statement like CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b)) created only one constraint index (for primary key) and no index for UNIQUE constraint (since it is upon the same columns), neither it is named or non-named constraint. After the patch index will be always created for named constraints. It is a temporary solution. In future it's preferable not to create an index, but to make some record in _constraints space that this named unique constraint implemented with the same index as primary key constraint. Closes: #3369, #3498
SudoBobo
added a commit
that referenced
this issue
Jul 17, 2018
Now every sqlite struct Index is created with tnt struct index_def inside. This allows us to use tnt index_def in work with sqlite indexes in the same manner as with tnt index and is a step to remove sqlite Index with tnt index. Fields coll_array, coll_id_array, aiColumn, sort_order, aiRowLogEst and zName are removed from Index. All usages of this fields changed to usage of corresponding index_def or index_def->opts fields. index_is_unique(), sql_index_collation() and index_column_count() are removed with calls of index_def corresponding fields. Also there is small change in behavior: before the patch a statement like CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b)) created only one constraint index (for primary key) and no index for UNIQUE constraint (since it is upon the same columns), neither it is named or non-named constraint. After the patch index will be always created for named constraints. It is a temporary solution. In future it's preferable not to create an index, but to make some record in _constraints space that this named unique constraint implemented with the same index as primary key constraint. Closes: #3369, #3498
kyukhin
pushed a commit
that referenced
this issue
Jul 17, 2018
Now every sqlite struct Index is created with tnt struct index_def inside. This allows us to use tnt index_def in work with sqlite indexes in the same manner as with tnt index and is a step to remove sqlite Index with tnt index. Fields coll_array, coll_id_array, aiColumn, sort_order, aiRowLogEst and zName are removed from Index. All usages of this fields changed to usage of corresponding index_def or index_def->opts fields. index_is_unique(), sql_index_collation() and index_column_count() are removed with calls of index_def corresponding fields. Also there is small change in behavior: before the patch a statement like CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b)) created only one constraint index (for primary key) and no index for UNIQUE constraint (since it is upon the same columns), neither it is named or non-named constraint. After the patch index will be always created for named constraints. It is a temporary solution. In future it's preferable not to create an index, but to make some record in _constraints space that this named unique constraint implemented with the same index as primary key constraint. Closes: #3369, #3498
Closed via 0bc6367 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce:
tarantool> box.sql.execute("CREATE TABLE t9 (s1 INT,UNIQUE(s1),PRIMARY KEY(s1));")
tarantool: /home/kir/tarantool/src/box/sql/build.c:1091: sql_index_key_def: Assertion `space != NULL' failed.
Mayby the grammar is wrong? How could we specify both UNIQUE and PRIMARY KEY?
The text was updated successfully, but these errors were encountered: