crud icon indicating copy to clipboard operation
crud copied to clipboard

Incorrect crud.select result with filter conditions an `unicode_ci` index

Open oleg-jukovec opened this issue 3 years ago • 0 comments

Consider a space developers with an unicode_ci index:

box.schema.create_space('developers', {
    format = {
        {name = 'id', type = 'unsigned'},
        {name = 'bucket_id', type = 'unsigned'},
        {name = 'name', type = 'string'},
    }
})
box.space.developers:create_index('primary_index', {
    parts = {
        {field = 1, type = 'unsigned'},
    },
})
box.space.developers:create_index('bucket_id', {
    parts = {
        {field = 2, type = 'unsigned'},
    },
    unique = false,
})
box.space.developers:create_index('full_name', {
    parts = {
        {field = 3, type = 'string', collation = 'unicode_ci'},
    },
    unique = false,
})

Without filter conditions crud.select looks fine:

tarantool> crud.select('developers').rows
---
- - [1, 477, 'Alexey']
  - [2, 401, 'Sergey']
  - [3, 1064, 'alexey']
...

tarantool> crud.select('developers', {{'==', 'name', 'alexey'}}).rows
---
- - [1, 477, 'Alexey']
  - [3, 1064, 'alexey']
...

tarantool> crud.select('developers', {{'>=', 'name', 'alexey'}}).rows
---
- - [1, 477, 'Alexey']
  - [3, 1064, 'alexey']
  - [2, 401, 'Sergey']
...

But with additional filter conditions it's broken:

tarantool> crud.select('developers', {{'>=', 'name', 'alexey'}, {'=', 'name', 'alexey'}}).rows
---
- - [3, 1064, 'alexey']
...

tarantool> crud.select('developers', {{'>=', 'name', 'alexey'}, {'<=', 'name', 'alexey'}}).rows
---
- - [1, 477, 'Alexey']
  - [3, 1064, 'alexey']
  - [2, 401, 'Sergey']
...

oleg-jukovec avatar Jun 09 '22 12:06 oleg-jukovec