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
54bc9c3d
Commit
54bc9c3d
authored
Apr 02, 2007
by
gluh@mysql.com/eagle.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#27069 set with identical elements are created
added the check for unique elements count in SET
parent
898ec87e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
8 deletions
+49
-8
mysql-test/r/type_set.result
mysql-test/r/type_set.result
+19
-0
mysql-test/t/type_set.test
mysql-test/t/type_set.test
+17
-0
sql/field.cc
sql/field.cc
+0
-5
sql/sql_table.cc
sql/sql_table.cc
+13
-3
No files found.
mysql-test/r/type_set.result
View file @
54bc9c3d
...
@@ -66,3 +66,22 @@ ss
...
@@ -66,3 +66,22 @@ ss
ue
ue
ue
ue
DROP TABLE t1;
DROP TABLE t1;
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','128'));
ERROR HY000: Too many strings for column f1 and SET
create table t1(f1
set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
Warnings:
Note 1291 Column 'f1' has duplicated value '1' in SET
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
mysql-test/t/type_set.test
View file @
54bc9c3d
...
@@ -39,3 +39,20 @@ SELECT c FROM t1 ORDER BY concat(c);
...
@@ -39,3 +39,20 @@ SELECT c FROM t1 ORDER BY concat(c);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# End of 4.1 tests
# End of 4.1 tests
#
# Bug#27069 set with identical elements are created
#
--
error
1097
create
table
t1
(
f1
set
(
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'10'
,
'11'
,
'12'
,
'13'
,
'14'
,
'15'
,
'16'
,
'17'
,
'18'
,
'19'
,
'20'
,
'21'
,
'22'
,
'23'
,
'24'
,
'25'
,
'26'
,
'27'
,
'28'
,
'29'
,
'30'
,
'31'
,
'32'
,
'33'
,
'34'
,
'35'
,
'36'
,
'37'
,
'38'
,
'39'
,
'40'
,
'41'
,
'42'
,
'43'
,
'44'
,
'45'
,
'46'
,
'47'
,
'48'
,
'49'
,
'50'
,
'51'
,
'52'
,
'53'
,
'54'
,
'55'
,
'56'
,
'57'
,
'58'
,
'59'
,
'60'
,
'61'
,
'62'
,
'63'
,
'64'
,
'128'
));
create
table
t1
(
f1
set
(
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'10'
,
'11'
,
'12'
,
'13'
,
'14'
,
'15'
,
'16'
,
'17'
,
'18'
,
'19'
,
'20'
,
'21'
,
'22'
,
'23'
,
'24'
,
'25'
,
'26'
,
'27'
,
'28'
,
'29'
,
'30'
,
'31'
,
'32'
,
'33'
,
'34'
,
'35'
,
'36'
,
'37'
,
'38'
,
'39'
,
'40'
,
'41'
,
'42'
,
'43'
,
'44'
,
'45'
,
'46'
,
'47'
,
'48'
,
'49'
,
'50'
,
'51'
,
'52'
,
'53'
,
'54'
,
'55'
,
'56'
,
'57'
,
'58'
,
'59'
,
'60'
,
'61'
,
'62'
,
'63'
,
'64'
,
'1'
));
show
create
table
t1
;
drop
table
t1
;
sql/field.cc
View file @
54bc9c3d
...
@@ -8676,11 +8676,6 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
...
@@ -8676,11 +8676,6 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
break
;
break
;
case
FIELD_TYPE_SET
:
case
FIELD_TYPE_SET
:
{
{
if
(
fld_interval_list
->
elements
>
sizeof
(
longlong
)
*
8
)
{
my_error
(
ER_TOO_BIG_SET
,
MYF
(
0
),
fld_name
);
/* purecov: inspected */
DBUG_RETURN
(
TRUE
);
}
pack_length
=
get_set_pack_length
(
fld_interval_list
->
elements
);
pack_length
=
get_set_pack_length
(
fld_interval_list
->
elements
);
List_iterator
<
String
>
it
(
*
fld_interval_list
);
List_iterator
<
String
>
it
(
*
fld_interval_list
);
...
...
sql/sql_table.cc
View file @
54bc9c3d
...
@@ -407,6 +407,7 @@ static int sort_keys(KEY *a, KEY *b)
...
@@ -407,6 +407,7 @@ static int sort_keys(KEY *a, KEY *b)
set_or_name "SET" or "ENUM" string for warning message
set_or_name "SET" or "ENUM" string for warning message
name name of the checked column
name name of the checked column
typelib list of values for the column
typelib list of values for the column
dup_val_count returns count of duplicate elements
DESCRIPTION
DESCRIPTION
This function prints an warning for each value in list
This function prints an warning for each value in list
...
@@ -418,11 +419,12 @@ static int sort_keys(KEY *a, KEY *b)
...
@@ -418,11 +419,12 @@ static int sort_keys(KEY *a, KEY *b)
void
check_duplicates_in_interval
(
const
char
*
set_or_name
,
void
check_duplicates_in_interval
(
const
char
*
set_or_name
,
const
char
*
name
,
TYPELIB
*
typelib
,
const
char
*
name
,
TYPELIB
*
typelib
,
CHARSET_INFO
*
cs
)
CHARSET_INFO
*
cs
,
unsigned
int
*
dup_val_count
)
{
{
TYPELIB
tmp
=
*
typelib
;
TYPELIB
tmp
=
*
typelib
;
const
char
**
cur_value
=
typelib
->
type_names
;
const
char
**
cur_value
=
typelib
->
type_names
;
unsigned
int
*
cur_length
=
typelib
->
type_lengths
;
unsigned
int
*
cur_length
=
typelib
->
type_lengths
;
*
dup_val_count
=
0
;
for
(
;
tmp
.
count
>
1
;
cur_value
++
,
cur_length
++
)
for
(
;
tmp
.
count
>
1
;
cur_value
++
,
cur_length
++
)
{
{
...
@@ -435,6 +437,7 @@ void check_duplicates_in_interval(const char *set_or_name,
...
@@ -435,6 +437,7 @@ void check_duplicates_in_interval(const char *set_or_name,
ER_DUPLICATED_VALUE_IN_TYPE
,
ER_DUPLICATED_VALUE_IN_TYPE
,
ER
(
ER_DUPLICATED_VALUE_IN_TYPE
),
ER
(
ER_DUPLICATED_VALUE_IN_TYPE
),
name
,
*
cur_value
,
set_or_name
);
name
,
*
cur_value
,
set_or_name
);
(
*
dup_val_count
)
++
;
}
}
}
}
}
}
...
@@ -498,6 +501,7 @@ int prepare_create_field(create_field *sql_field,
...
@@ -498,6 +501,7 @@ int prepare_create_field(create_field *sql_field,
int
*
timestamps
,
int
*
timestamps_with_niladic
,
int
*
timestamps
,
int
*
timestamps_with_niladic
,
uint
table_flags
)
uint
table_flags
)
{
{
unsigned
int
dup_val_count
;
DBUG_ENTER
(
"prepare_field"
);
DBUG_ENTER
(
"prepare_field"
);
/*
/*
...
@@ -573,7 +577,7 @@ int prepare_create_field(create_field *sql_field,
...
@@ -573,7 +577,7 @@ int prepare_create_field(create_field *sql_field,
sql_field
->
unireg_check
=
Field
::
INTERVAL_FIELD
;
sql_field
->
unireg_check
=
Field
::
INTERVAL_FIELD
;
check_duplicates_in_interval
(
"ENUM"
,
sql_field
->
field_name
,
check_duplicates_in_interval
(
"ENUM"
,
sql_field
->
field_name
,
sql_field
->
interval
,
sql_field
->
interval
,
sql_field
->
charset
);
sql_field
->
charset
,
&
dup_val_count
);
break
;
break
;
case
FIELD_TYPE_SET
:
case
FIELD_TYPE_SET
:
sql_field
->
pack_flag
=
pack_length_to_packflag
(
sql_field
->
pack_length
)
|
sql_field
->
pack_flag
=
pack_length_to_packflag
(
sql_field
->
pack_length
)
|
...
@@ -583,7 +587,13 @@ int prepare_create_field(create_field *sql_field,
...
@@ -583,7 +587,13 @@ int prepare_create_field(create_field *sql_field,
sql_field
->
unireg_check
=
Field
::
BIT_FIELD
;
sql_field
->
unireg_check
=
Field
::
BIT_FIELD
;
check_duplicates_in_interval
(
"SET"
,
sql_field
->
field_name
,
check_duplicates_in_interval
(
"SET"
,
sql_field
->
field_name
,
sql_field
->
interval
,
sql_field
->
interval
,
sql_field
->
charset
);
sql_field
->
charset
,
&
dup_val_count
);
/* Check that count of unique members is not more then 64 */
if
(
sql_field
->
interval
->
count
-
dup_val_count
>
sizeof
(
longlong
)
*
8
)
{
my_error
(
ER_TOO_BIG_SET
,
MYF
(
0
),
sql_field
->
field_name
);
DBUG_RETURN
(
1
);
}
break
;
break
;
case
FIELD_TYPE_DATE
:
// Rest of string types
case
FIELD_TYPE_DATE
:
// Rest of string types
case
FIELD_TYPE_NEWDATE
:
case
FIELD_TYPE_NEWDATE
:
...
...
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