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
a23df4a6
Commit
a23df4a6
authored
12 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Provide a more verbose error when violating a unique key.
parent
d92b96e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/errcode.h
+1
-1
1 addition, 1 deletion
include/errcode.h
mod/box/space.m
+2
-1
2 additions, 1 deletion
mod/box/space.m
test/box_big/lua.result
+13
-1
13 additions, 1 deletion
test/box_big/lua.result
test/box_big/lua.test
+5
-1
5 additions, 1 deletion
test/box_big/lua.test
with
21 additions
and
4 deletions
include/errcode.h
+
1
−
1
View file @
a23df4a6
...
@@ -108,7 +108,7 @@ enum { TNT_ERRMSG_MAX = 512 };
...
@@ -108,7 +108,7 @@ enum { TNT_ERRMSG_MAX = 512 };
/* 53 */
_(ER_NO_SUCH_INDEX, 2, "No index #%u is defined in space %u") \
/* 53 */
_(ER_NO_SUCH_INDEX, 2, "No index #%u is defined in space %u") \
/* 54 */
_(ER_NO_SUCH_FIELD, 2, "Field %u was not found in the tuple") \
/* 54 */
_(ER_NO_SUCH_FIELD, 2, "Field %u was not found in the tuple") \
/* 55 */
_(ER_TUPLE_FOUND, 2, "Tuple already exists") \
/* 55 */
_(ER_TUPLE_FOUND, 2, "Tuple already exists") \
/* 56 */
_(ER_INDEX_VIOLATION, 2, "Duplicate key exists in
a
unique index") \
/* 56 */
_(ER_INDEX_VIOLATION, 2, "Duplicate key exists in unique index
%d
") \
/* 57 */
_(ER_NO_SUCH_SPACE, 2, "Space %u does not exist")
/* 57 */
_(ER_NO_SUCH_SPACE, 2, "Space %u does not exist")
...
...
This diff is collapsed.
Click to expand it.
mod/box/space.m
+
2
−
1
View file @
a23df4a6
...
@@ -175,7 +175,8 @@ space_validate(struct space *sp, struct tuple *old_tuple,
...
@@ -175,7 +175,8 @@ space_validate(struct space *sp, struct tuple *old_tuple,
if
(
index
->
key
_
def
->
is
_
unique
)
{
if
(
index
->
key
_
def
->
is
_
unique
)
{
struct
tuple
*
tuple
=
[
index
findByTuple
:
new
_
tuple
]
;
struct
tuple
*
tuple
=
[
index
findByTuple
:
new
_
tuple
]
;
if
(
tuple
!=
NULL
&&
tuple
!=
old
_
tuple
)
if
(
tuple
!=
NULL
&&
tuple
!=
old
_
tuple
)
tnt
_
raise
(
ClientError
,
:
ER
_
INDEX
_
VIOLATION
)
;
tnt
_
raise
(
ClientError
,
:
ER
_
INDEX
_
VIOLATION
,
index
_
n
(
index
))
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
test/box_big/lua.result
+
13
−
1
View file @
a23df4a6
...
@@ -533,7 +533,7 @@ lua push_collection(5, 1038784, 'hey')
...
@@ -533,7 +533,7 @@ lua push_collection(5, 1038784, 'hey')
---
---
- 1038784: {26984, 'hey', 'hey', 'hey', 'hey'}
- 1038784: {26984, 'hey', 'hey', 'hey', 'hey'}
...
...
A test case for Bug#1060967: truncation of 64-bit numbers
#
A test case for Bug#1060967: truncation of 64-bit numbers
lua box.space[5]:insert(2^51, 'hello', 'world')
lua box.space[5]:insert(2^51, 'hello', 'world')
---
---
- 2251799813685248: {'hello', 'world'}
- 2251799813685248: {'hello', 'world'}
...
@@ -545,3 +545,15 @@ lua box.space[5]:select(0, 2^51)
...
@@ -545,3 +545,15 @@ lua box.space[5]:select(0, 2^51)
lua box.space[5]:truncate()
lua box.space[5]:truncate()
---
---
...
...
# Test that we print index number in error ER_INDEX_VIOLATION
lua box.space[1]:insert(1, 'hello', 'world')
---
- 1: {'hello', 'world'}
...
lua box.space[1]:insert(2, 'hello', 'world')
---
error: 'Duplicate key exists in unique index 1'
...
lua box.space[1]:truncate()
---
...
This diff is collapsed.
Click to expand it.
test/box_big/lua.test
+
5
−
1
View file @
a23df4a6
...
@@ -197,7 +197,11 @@ exec admin "lua push_collection(5, 1038784, 'hey')"
...
@@ -197,7 +197,11 @@ exec admin "lua push_collection(5, 1038784, 'hey')"
exec admin "lua push_collection(5, 1038784, '
hey
')"
exec admin "lua push_collection(5, 1038784, '
hey
')"
exec admin "lua push_collection(5, 1038784, '
hey
')"
exec admin "lua push_collection(5, 1038784, '
hey
')"
print """A test case for Bug#1060967: truncation of 64-bit numbers"""
print """
#
A test case for Bug#1060967: truncation of 64-bit numbers"""
exec admin "lua box.space[5]:insert(2^51, '
hello
', '
world
')"
exec admin "lua box.space[5]:insert(2^51, '
hello
', '
world
')"
exec admin "lua box.space[5]:select(0, 2^51)"
exec admin "lua box.space[5]:select(0, 2^51)"
exec admin "lua box.space[5]:truncate()"
exec admin "lua box.space[5]:truncate()"
print """# Test that we print index number in error ER_INDEX_VIOLATION"""
exec admin "lua box.space[1]:insert(1, '
hello
', '
world
')"
exec admin "lua box.space[1]:insert(2, '
hello
', '
world
'
)
"
exec admin "
lua
box
.
space
[
1
]
:
truncate
()
"
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