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
c6d08ecc
Commit
c6d08ecc
authored
Apr 20, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
bc902a2b
' into 10.1
parents
18715bef
bc902a2b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
15 deletions
+117
-15
mysql-test/r/ctype_create.result
mysql-test/r/ctype_create.result
+32
-0
mysql-test/t/ctype_create.test
mysql-test/t/ctype_create.test
+36
-0
sql/handler.cc
sql/handler.cc
+19
-0
sql/handler.h
sql/handler.h
+27
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-15
No files found.
mysql-test/r/ctype_create.result
View file @
c6d08ecc
...
...
@@ -76,3 +76,35 @@ ALTER DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
ERROR 42000: Incorrect database name ''
USE test;
#
# Start of 10.0 tests
#
#
# MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
#
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT' and 'CHARACTER SET utf8'
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET DEFAULT'
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET utf8;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET latin1'
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8' and 'CHARACTER SET DEFAULT'
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8'
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT'
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET utf8'
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET latin1'
DROP TABLE t1;
#
# End of 10.0 tests
#
mysql-test/t/ctype_create.test
View file @
c6d08ecc
...
...
@@ -105,3 +105,39 @@ ALTER DATABASE DEFAULT CHARACTER SET latin2;
ALTER
DATABASE
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DEFAULT
CHARACTER
SET
latin2
;
--
error
1102
ALTER
DATABASE
``
DEFAULT
CHARACTER
SET
latin2
;
USE
test
;
--
echo
#
--
echo
# Start of 10.0 tests
--
echo
#
--
echo
#
--
echo
# MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
--
echo
#
--
error
ER_CONFLICTING_DECLARATIONS
CREATE
TABLE
t1
(
a
VARCHAR
(
10
))
CHARACTER
SET
DEFAULT
,
CHARACTER
SET
utf8
;
--
error
ER_CONFLICTING_DECLARATIONS
CREATE
TABLE
t1
(
a
VARCHAR
(
10
))
CHARACTER
SET
utf8
,
CHARACTER
SET
DEFAULT
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
))
CHARACTER
SET
utf8
,
CHARACTER
SET
utf8
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
))
CHARACTER
SET
DEFAULT
,
CHARACTER
SET
DEFAULT
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
,
b
VARCHAR
(
10
)
CHARACTER
SET
utf8
);
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
utf8
,
CHARACTER
SET
latin1
;
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
utf8
,
CHARACTER
SET
DEFAULT
;
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
latin1
,
CHARACTER
SET
utf8
;
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
latin1
,
CHARACTER
SET
DEFAULT
;
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
DEFAULT
,
CHARACTER
SET
utf8
;
--
error
ER_CONFLICTING_DECLARATIONS
ALTER
TABLE
t1
CONVERT
TO
CHARACTER
SET
DEFAULT
,
CHARACTER
SET
latin1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.0 tests
--
echo
#
sql/handler.cc
View file @
c6d08ecc
...
...
@@ -6274,3 +6274,22 @@ fl_create_iterator(enum handler_iterator_type type,
}
}
#endif
/*TRANS_LOG_MGM_EXAMPLE_CODE*/
bool
HA_CREATE_INFO
::
check_conflicting_charset_declarations
(
CHARSET_INFO
*
cs
)
{
if
((
used_fields
&
HA_CREATE_USED_DEFAULT_CHARSET
)
&&
/* DEFAULT vs explicit, or explicit vs DEFAULT */
(((
default_table_charset
==
NULL
)
!=
(
cs
==
NULL
))
||
/* Two different explicit character sets */
(
default_table_charset
&&
cs
&&
!
my_charset_same
(
default_table_charset
,
cs
))))
{
my_error
(
ER_CONFLICTING_DECLARATIONS
,
MYF
(
0
),
"CHARACTER SET "
,
default_table_charset
?
default_table_charset
->
csname
:
"DEFAULT"
,
"CHARACTER SET "
,
cs
?
cs
->
csname
:
"DEFAULT"
);
return
true
;
}
return
false
;
}
sql/handler.h
View file @
c6d08ecc
...
...
@@ -1697,6 +1697,33 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
Table_scope_and_contents_source_st
::
init
();
Schema_specification_st
::
init
();
}
bool
check_conflicting_charset_declarations
(
CHARSET_INFO
*
cs
);
bool
add_table_option_default_charset
(
CHARSET_INFO
*
cs
)
{
// cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
if
(
check_conflicting_charset_declarations
(
cs
))
return
true
;
default_table_charset
=
cs
;
used_fields
|=
HA_CREATE_USED_DEFAULT_CHARSET
;
return
false
;
}
bool
add_alter_list_item_convert_to_charset
(
CHARSET_INFO
*
cs
)
{
/*
cs cannot be NULL, as sql_yacc.yy translates
CONVERT TO CHARACTER SET DEFAULT
to
CONVERT TO CHARACTER SET <character-set-of-the-current-database>
TODO: Should't we postpone resolution of DEFAULT until the
character set of the table owner database is loaded from its db.opt?
*/
DBUG_ASSERT
(
cs
);
if
(
check_conflicting_charset_declarations
(
cs
))
return
true
;
table_charset
=
default_table_charset
=
cs
;
used_fields
|=
(
HA_CREATE_USED_CHARSET
|
HA_CREATE_USED_DEFAULT_CHARSET
);
return
false
;
}
};
...
...
sql/sql_yacc.yy
View file @
c6d08ecc
...
...
@@ -5888,18 +5888,8 @@ create_table_option:
default_charset:
opt_default charset opt_equal charset_name_or_default
{
HA_CREATE_INFO *cinfo= &Lex->create_info;
if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4))
{
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
"CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname);
if (Lex->create_info.add_table_option_default_charset($4))
MYSQL_YYABORT;
}
Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
}
;
...
...
@@ -7708,10 +7698,8 @@ alter_list_item:
MYSQL_YYABORT;
}
LEX *lex= Lex;
lex->create_info.table_charset=
lex->create_info.default_table_charset= $5;
lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
HA_CREATE_USED_DEFAULT_CHARSET);
if (lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT;
lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
}
| create_table_options_space_separated
...
...
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