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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
ca133ba6
Commit
ca133ba6
authored
Dec 07, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1
into gluh.mysql.r18.ru:/home/gluh/MySQL-BUGS/mysql-4.1.6840
parents
9020669a
1412874e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
25 deletions
+48
-25
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+8
-0
mysql-test/t/type_enum.test
mysql-test/t/type_enum.test
+14
-1
sql/sql_table.cc
sql/sql_table.cc
+26
-24
No files found.
mysql-test/r/type_enum.result
View file @
ca133ba6
...
...
@@ -1737,3 +1737,11 @@ def test t1 t1 c c 254 3 0 Y 384 0 8
a b c
Y NULL NULL
drop table t1;
create table t1 (a enum('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;
create table t1 (a set('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;
mysql-test/t/type_enum.test
View file @
ca133ba6
...
...
@@ -111,5 +111,18 @@ alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
alter
table
t1
add
c
enum
(
'Y'
,
'N'
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
;
--
enable_metadata
select
*
from
t1
;
--
disable
metadata
--
disable_metadata
drop
table
t1
;
#
# Bug #6840 Default value is not checked in ALTER column SET DEFAULT 'x'
#
create
table
t1
(
a
enum
(
'x'
,
'y'
)
default
'x'
);
--
error
1067
alter
table
t1
alter
a
set
default
'z'
;
drop
table
t1
;
create
table
t1
(
a
set
(
'x'
,
'y'
)
default
'x'
);
--
error
1067
alter
table
t1
alter
a
set
default
'z'
;
drop
table
t1
;
sql/sql_table.cc
View file @
ca133ba6
...
...
@@ -485,43 +485,45 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN
(
-
1
);
}
if
(
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
||
sql_field
->
sql_type
==
FIELD_TYPE_ENUM
)
&&
!
sql_field
->
interval
)
if
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
||
sql_field
->
sql_type
==
FIELD_TYPE_ENUM
)
{
uint32
dummy
;
CHARSET_INFO
*
cs
=
sql_field
->
charset
;
TYPELIB
*
interval
;
TYPELIB
*
interval
=
sql_field
->
interval
;
/*
Create typelib from interval_list, and if necessary
convert strings from client character set to the
column character set.
*/
interval
=
sql_field
->
interval
=
typelib
(
sql_field
->
interval_list
);
List_iterator
<
String
>
it
(
sql_field
->
interval_list
);
String
conv
,
*
tmp
;
for
(
uint
i
=
0
;
(
tmp
=
it
++
);
i
++
)
if
(
!
interval
)
{
if
(
String
::
needs_conversion
(
tmp
->
length
(),
tmp
->
charset
(),
cs
,
&
dummy
))
interval
=
sql_field
->
interval
=
typelib
(
sql_field
->
interval_list
);
List_iterator
<
String
>
it
(
sql_field
->
interval_list
);
String
conv
,
*
tmp
;
for
(
uint
i
=
0
;
(
tmp
=
it
++
);
i
++
)
{
uint
cnv_errs
;
conv
.
copy
(
tmp
->
ptr
(),
tmp
->
length
(),
tmp
->
charset
(),
cs
,
&
cnv_errs
);
char
*
buf
=
(
char
*
)
sql_alloc
(
conv
.
length
()
+
1
);
memcpy
(
buf
,
conv
.
ptr
(),
conv
.
length
());
buf
[
conv
.
length
()]
=
'\0'
;
interval
->
type_names
[
i
]
=
buf
;
interval
->
type_lengths
[
i
]
=
conv
.
length
();
}
if
(
String
::
needs_conversion
(
tmp
->
length
(),
tmp
->
charset
(),
cs
,
&
dummy
))
{
uint
cnv_errs
;
conv
.
copy
(
tmp
->
ptr
(),
tmp
->
length
(),
tmp
->
charset
(),
cs
,
&
cnv_errs
);
char
*
buf
=
(
char
*
)
sql_alloc
(
conv
.
length
()
+
1
);
memcpy
(
buf
,
conv
.
ptr
(),
conv
.
length
());
buf
[
conv
.
length
()]
=
'\0'
;
interval
->
type_names
[
i
]
=
buf
;
interval
->
type_lengths
[
i
]
=
conv
.
length
();
}
// Strip trailing spaces.
uint
lengthsp
=
cs
->
cset
->
lengthsp
(
cs
,
interval
->
type_names
[
i
],
interval
->
type_lengths
[
i
]);
interval
->
type_lengths
[
i
]
=
lengthsp
;
((
uchar
*
)
interval
->
type_names
[
i
])[
lengthsp
]
=
'\0'
;
// Strip trailing spaces.
uint
lengthsp
=
cs
->
cset
->
lengthsp
(
cs
,
interval
->
type_names
[
i
],
interval
->
type_lengths
[
i
]);
interval
->
type_lengths
[
i
]
=
lengthsp
;
((
uchar
*
)
interval
->
type_names
[
i
])[
lengthsp
]
=
'\0'
;
}
sql_field
->
interval_list
.
empty
();
// Don't need interval_list anymore
}
sql_field
->
interval_list
.
empty
();
// Don't need interval_list anymore
/*
Convert the default value from client character
...
...
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