Skip to content
Snippets Groups Projects
Commit 04f1ac51 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge remote-tracking branch 'origin/fix-gh-521-update-error-message-v2'

parents 7beed146 72ccbd51
No related branches found
No related tags found
No related merge requests found
......@@ -441,19 +441,24 @@ end
-- Change one-based indexing in update commands to zero-based.
--
local function normalize_update_ops(ops)
if type(ops) ~= 'table' then
return ops;
end
for _, op in ipairs(ops) do
if op[1] == ':' then
-- fix offset for splice
if op[3] > 0 then
op[3] = op[3] - 1
elseif op[3] == 0 then
box.error(box.error.SPLICE, op[2], "offset is out of bound")
if type(op) == 'table' then
if op[1] == ':' then
-- fix offset for splice
if op[3] > 0 then
op[3] = op[3] - 1
elseif op[3] == 0 then
box.error(box.error.SPLICE, op[2], "offset is out of bound")
end
end
if op[2] > 0 then
op[2] = op[2] - 1
elseif op[2] == 0 then
box.error(box.error.NO_SUCH_FIELD, op[2])
end
end
if op[2] > 0 then
op[2] = op[2] - 1
elseif op[2] == 0 then
box.error(box.error.NO_SUCH_FIELD, op[2])
end
end
return ops
......
......@@ -330,3 +330,25 @@ s:truncate()
s:drop()
---
...
-- #521: Cryptic error message in update operation
s = box.schema.create_space('tweedledum')
---
...
s:create_index('pk')
---
...
s:insert{1, 2, 3}
---
- [1, 2, 3]
...
s:update({1})
---
- error: Tuple/Key must be MsgPack array
...
s:update({1}, {'=', 1, 1})
---
- error: Invalid MsgPack - expected an update operation name (string)
...
s:drop()
---
...
......@@ -110,3 +110,11 @@ s = box.space.tweedledum
s:select{}
s:truncate()
s:drop()
-- #521: Cryptic error message in update operation
s = box.schema.create_space('tweedledum')
s:create_index('pk')
s:insert{1, 2, 3}
s:update({1})
s:update({1}, {'=', 1, 1})
s:drop()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment