Skip to content

Failed to select with datetime conditions #373

Closed
@DifferentialOrange

Description

@DifferentialOrange

Simple reproducer is as follows.

  1. Extend playground space format.
--- a/doc/playground.lua
+++ b/doc/playground.lua
@@ -66,6 +66,7 @@ box.once('customers', function()
             {name = 'bucket_id', type = 'unsigned'},
             {name = 'name', type = 'string'},
             {name = 'age', type = 'number'},
+            {name = 'date', type = 'datetime', is_nullable = true},
         }
     })
     box.space.customers:create_index('primary_index', {
  1. Run the updated playground.
./doc/playground.lua
  1. Try to select with datetime condition
tarantool> dt = require('datetime').parse('2022-01-01T00:00:00Z')
---
...

tarantool> crud.select('customers', {{'==', 'date', dt}}, {first = 1})
---
- null
- line: 183
  class_name: SelectError
  err: '...velopment/github/tarantool/crud/crud/compare/filters.lua:636: [string "library"]:4:
    malformed number near ''01T00'''
  file: '...ment/github/tarantool/crud/crud/common/sharding/init.lua'
  stack: "stack traceback:\n\t...ment/github/tarantool/crud/crud/common/sharding/init.lua:183:
    in function <...ment/github/tarantool/crud/crud/common/sharding/init.lua:168>\n\t[C]:
    in function 'xpcall'\n\t.../github/tarantool/crud/.rocks/share/tarantool/errors.lua:145:
    in function <.../github/tarantool/crud/.rocks/share/tarantool/errors.lua:139>\n\t[C]:
    in function 'pcall'\n\tbuiltin/box/console.lua:415: in function 'eval'\n\tbuiltin/box/console.lua:750:
    in function 'repl'\n\tbuiltin/box/console.lua:801: in function 'start'\n\t./doc/playground.lua:150:
    in main chunk"
  str: 'SelectError: ...velopment/github/tarantool/crud/crud/compare/filters.lua:636:
    [string "library"]:4: malformed number near ''01T00'''
...

As a follow up, we also may verify other extended types like decimal, uuid and interval.

Metadata

Metadata

Labels

2spbugSomething isn't workingteamE

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions