Skip to content

Instantly share code, notes, and snippets.

@unera
Created October 5, 2016 13:48
Show Gist options
  • Save unera/5efd10f60497f667441c6376a967aaa7 to your computer and use it in GitHub Desktop.
Save unera/5efd10f60497f667441c6376a967aaa7 to your computer and use it in GitHub Desktop.
get error
#!/usr/bin/env tarantool
box.cfg{ logger = '/dev/null' }
local test = require('tap').test()
test:plan(3)
box.schema.space.create(
'test',
{
engine = 'memtx',
format = { { name = 'id' }, { name = 'domain' }, { name = 'path' } },
if_not_exists = true
}
)
box.space.test:create_index(
'pk',
{
unique = true,
type = 'hash',
parts = { 1, 'str' },
if_not_exists = true,
}
)
box.space.test:create_index(
'pti',
{
unique = false,
type = 'tree',
parts = { 3, 'str', 2, 'str', 1, 'str' },
if_not_exists = true,
}
)
box.space.test:truncate()
box.space.test:insert{'first', '', '/path/to'}
local tuples = box.space.test.index.pk:select({ 'first' }, { iterator = 'EQ' })
test:is(#tuples, 1, 'one tuple in database')
tuples = box.space.test.index.pti:select{ '/path/to', '', 'first' }
test:is(#tuples, 1, 'one tuple selected by secondary index')
local tuple = box.space.test.index.pti:get{ '/path/to', '', 'first' }
test:ok(tuple, 'tuple was selected by :get')
os.exit(test:check() == true and 0 or -1)
@unera
Copy link
Author

unera commented Oct 5, 2016

raise error:

2016-10-05 16:48:37.030 [27458] test.lua F> More than one tuple found by get()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment