Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
72ccbd51
Commit
72ccbd51
authored
10 years ago
by
Alexandr
Browse files
Options
Downloads
Patches
Plain Diff
fix gh-521 update-error-message
parent
6d1b3e2d
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/box/lua/schema.lua
+16
-11
16 additions, 11 deletions
src/box/lua/schema.lua
test/box/update.result
+22
-0
22 additions, 0 deletions
test/box/update.result
test/box/update.test.lua
+8
-0
8 additions, 0 deletions
test/box/update.test.lua
with
46 additions
and
11 deletions
src/box/lua/schema.lua
+
16
−
11
View file @
72ccbd51
...
...
@@ -443,19 +443,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
...
...
This diff is collapsed.
Click to expand it.
test/box/update.result
+
22
−
0
View file @
72ccbd51
...
...
@@ -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()
---
...
This diff is collapsed.
Click to expand it.
test/box/update.test.lua
+
8
−
0
View file @
72ccbd51
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment