Introduce "none" and "binary" collations
This patch introduces two new collation sequences: "none" and "binary". Despite the fact that they use the same comparing algorithm (simple byte-by-byte comparison), they don't mean the same. "binary" collation get to the format if user explicitly points it: either specifies this collation in space format manually or adds <COLLATE BINARY> clause to column definition within CREATE TABLE statement. "none" collation is used when user doesn't specify any collation at all. "none" collation always comes with id == 0 and it can't be changed (since its id vastly used under the hood as an indicator of absence of collation). Difference between these collations is vital for ANSI SQL: mixing "binary" with other collations is prohibited, meanwhile "none" collation can be used alongside with others. In this respect current patch extends list of available collations: now not only ICU collations are allowed, but also BINARY. Note, that in SQL some queries have changed their query plan. That occurred due to the fact that our parser allows using <COLLATE> clause with numeric fields: CREATE TABLE (id INT PRIMARY KEY); SELECT id COLLATE "binary" ... In the example collation of LHS (id column) is NULL, but collation of RHS is "binary". Before this patch both collations were NULL. Hence, usage of certain indexes may not be allowed by query planner. On the other hand, this feature is obviously broken, so that doesn't seem to be big deal. Needed for #3185
Showing
- src/box/alter.cc 10 additions, 1 deletionsrc/box/alter.cc
- src/box/bootstrap.snap 0 additions, 0 deletionssrc/box/bootstrap.snap
- src/box/coll_id.c 0 additions, 1 deletionsrc/box/coll_id.c
- src/box/coll_id.h 4 additions, 0 deletionssrc/box/coll_id.h
- src/box/errcode.h 1 addition, 0 deletionssrc/box/errcode.h
- src/box/key_def.h 0 additions, 6 deletionssrc/box/key_def.h
- src/box/lua/upgrade.lua 3 additions, 0 deletionssrc/box/lua/upgrade.lua
- src/box/sql/build.c 2 additions, 3 deletionssrc/box/sql/build.c
- src/box/sql/callback.c 2 additions, 3 deletionssrc/box/sql/callback.c
- src/box/sql/func.c 1 addition, 1 deletionsrc/box/sql/func.c
- src/coll.c 44 additions, 8 deletionssrc/coll.c
- src/coll_def.c 1 addition, 1 deletionsrc/coll_def.c
- src/coll_def.h 1 addition, 0 deletionssrc/coll_def.h
- test/box/ddl.result 12 additions, 8 deletionstest/box/ddl.result
- test/box/misc.result 1 addition, 0 deletionstest/box/misc.result
- test/box/net.box.result 1 addition, 1 deletiontest/box/net.box.result
- test/sql-tap/collation.test.lua 7 additions, 5 deletionstest/sql-tap/collation.test.lua
- test/sql-tap/distinct.test.lua 1 addition, 1 deletiontest/sql-tap/distinct.test.lua
- test/sql-tap/identifier_case.test.lua 6 additions, 2 deletionstest/sql-tap/identifier_case.test.lua
- test/sql-tap/in3.test.lua 1 addition, 1 deletiontest/sql-tap/in3.test.lua
Loading
Please register or sign in to comment