Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5672598f
Commit
5672598f
authored
Nov 22, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checks for NOT NULL for all fields in UNIQUE INDEX (USING HASH)
parent
6d6b38c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
2 deletions
+39
-2
mysql-test/r/ndb_index_unique.result
mysql-test/r/ndb_index_unique.result
+7
-0
mysql-test/t/ndb_index_unique.test
mysql-test/t/ndb_index_unique.test
+8
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+22
-1
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+2
-1
No files found.
mysql-test/r/ndb_index_unique.result
View file @
5672598f
...
@@ -87,6 +87,13 @@ a b c
...
@@ -87,6 +87,13 @@ a b c
7 8 3
7 8 3
8 2 3
8 2 3
drop table t2;
drop table t2;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
CREATE TABLE t3 (
CREATE TABLE t3 (
a int unsigned NOT NULL,
a int unsigned NOT NULL,
b int unsigned not null,
b int unsigned not null,
...
...
mysql-test/t/ndb_index_unique.test
View file @
5672598f
...
@@ -58,6 +58,14 @@ select * from t2 order by a;
...
@@ -58,6 +58,14 @@ select * from t2 order by a;
drop
table
t2
;
drop
table
t2
;
--
error
1121
CREATE
TABLE
t2
(
a
int
unsigned
NOT
NULL
PRIMARY
KEY
,
b
int
unsigned
not
null
,
c
int
unsigned
,
UNIQUE
USING
HASH
(
b
,
c
)
)
engine
=
ndbcluster
;
#
#
# Show use of PRIMARY KEY USING HASH indexes
# Show use of PRIMARY KEY USING HASH indexes
#
#
...
...
sql/ha_ndbcluster.cc
View file @
5672598f
...
@@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
...
@@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
error
=
create_unique_index
(
unique_index_name
,
key_info
);
error
=
create_unique_index
(
unique_index_name
,
key_info
);
break
;
break
;
case
UNIQUE_INDEX
:
case
UNIQUE_INDEX
:
error
=
create_unique_index
(
unique_index_name
,
key_info
);
if
(
!
(
error
=
check_index_fields_not_null
(
i
)))
error
=
create_unique_index
(
unique_index_name
,
key_info
);
break
;
break
;
case
ORDERED_INDEX
:
case
ORDERED_INDEX
:
error
=
create_ordered_index
(
index_name
,
key_info
);
error
=
create_ordered_index
(
index_name
,
key_info
);
...
@@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
...
@@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
ORDERED_INDEX
);
ORDERED_INDEX
);
}
}
int
ha_ndbcluster
::
check_index_fields_not_null
(
uint
inx
)
{
KEY
*
key_info
=
table
->
key_info
+
inx
;
KEY_PART_INFO
*
key_part
=
key_info
->
key_part
;
KEY_PART_INFO
*
end
=
key_part
+
key_info
->
key_parts
;
DBUG_ENTER
(
"check_index_fields_not_null"
);
for
(;
key_part
!=
end
;
key_part
++
)
{
Field
*
field
=
key_part
->
field
;
if
(
field
->
maybe_null
())
{
my_printf_error
(
ER_NULL_COLUMN_IN_INDEX
,
ER
(
ER_NULL_COLUMN_IN_INDEX
),
MYF
(
0
),
field
->
field_name
);
DBUG_RETURN
(
ER_NULL_COLUMN_IN_INDEX
);
}
}
DBUG_RETURN
(
0
);
}
void
ha_ndbcluster
::
release_metadata
()
void
ha_ndbcluster
::
release_metadata
()
{
{
...
...
sql/ha_ndbcluster.h
View file @
5672598f
...
@@ -160,7 +160,8 @@ class ha_ndbcluster: public handler
...
@@ -160,7 +160,8 @@ class ha_ndbcluster: public handler
void
release_metadata
();
void
release_metadata
();
NDB_INDEX_TYPE
get_index_type
(
uint
idx_no
)
const
;
NDB_INDEX_TYPE
get_index_type
(
uint
idx_no
)
const
;
NDB_INDEX_TYPE
get_index_type_from_table
(
uint
index_no
)
const
;
NDB_INDEX_TYPE
get_index_type_from_table
(
uint
index_no
)
const
;
int
check_index_fields_not_null
(
uint
index_no
);
int
pk_read
(
const
byte
*
key
,
uint
key_len
,
byte
*
buf
);
int
pk_read
(
const
byte
*
key
,
uint
key_len
,
byte
*
buf
);
int
complemented_pk_read
(
const
byte
*
old_data
,
byte
*
new_data
);
int
complemented_pk_read
(
const
byte
*
old_data
,
byte
*
new_data
);
int
peek_row
();
int
peek_row
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment