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
71f530c4
Commit
71f530c4
authored
Apr 11, 2005
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
fc0e6aa2
16e18677
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
3 deletions
+70
-3
mysql-test/r/ctype_collate.result
mysql-test/r/ctype_collate.result
+13
-0
mysql-test/r/union.result
mysql-test/r/union.result
+1
-1
mysql-test/t/ctype_collate.test
mysql-test/t/ctype_collate.test
+12
-0
mysql-test/t/union.test
mysql-test/t/union.test
+1
-1
sql/ha_innodb.cc
sql/ha_innodb.cc
+26
-0
sql/ha_innodb.h
sql/ha_innodb.h
+1
-0
sql/handler.h
sql/handler.h
+2
-0
sql/item.cc
sql/item.cc
+10
-1
sql/sql_table.cc
sql/sql_table.cc
+4
-0
No files found.
mysql-test/r/ctype_collate.result
View file @
71f530c4
...
@@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci);
...
@@ -535,6 +535,19 @@ s2 CHAR(5) COLLATE latin1_swedish_ci);
SELECT * FROM t1 WHERE s1 = s2;
SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1
(s1 CHAR(5) COLLATE latin1_german1_ci,
s2 CHAR(5) COLLATE latin1_swedish_ci,
s3 CHAR(5) COLLATE latin1_bin);
INSERT INTO t1 VALUES ('a','A','A');
SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
SELECT * FROM t1 WHERE s1 = s3;
s1 s2 s3
SELECT * FROM t1 WHERE s2 = s3;
s1 s2 s3
a A A
DROP TABLE t1;
SET NAMES latin1;
SET NAMES latin1;
CREATE TABLE t1
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,
(s1 char(10) COLLATE latin1_german1_ci,
...
...
mysql-test/r/union.result
View file @
71f530c4
...
@@ -1103,7 +1103,7 @@ count(*)
...
@@ -1103,7 +1103,7 @@ count(*)
drop table t1;
drop table t1;
create table t2 (
create table t2 (
a char character set latin1 collate latin1_swedish_ci,
a char character set latin1 collate latin1_swedish_ci,
b char character set latin1 collate latin1_
bin
);
b char character set latin1 collate latin1_
german1_ci
);
create table t1 as
create table t1 as
(select a from t2) union
(select a from t2) union
(select b from t2);
(select b from t2);
...
...
mysql-test/t/ctype_collate.test
View file @
71f530c4
...
@@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2;
...
@@ -158,6 +158,18 @@ SELECT * FROM t1 WHERE s1 = s2;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
s1
CHAR
(
5
)
COLLATE
latin1_german1_ci
,
s2
CHAR
(
5
)
COLLATE
latin1_swedish_ci
,
s3
CHAR
(
5
)
COLLATE
latin1_bin
);
INSERT
INTO
t1
VALUES
(
'a'
,
'A'
,
'A'
);
--
error
1267
SELECT
*
FROM
t1
WHERE
s1
=
s2
;
SELECT
*
FROM
t1
WHERE
s1
=
s3
;
SELECT
*
FROM
t1
WHERE
s2
=
s3
;
DROP
TABLE
t1
;
#
#
# Test that optimizer doesn't use indexes with wrong collation
# Test that optimizer doesn't use indexes with wrong collation
#
#
...
...
mysql-test/t/union.test
View file @
71f530c4
...
@@ -659,7 +659,7 @@ drop table t1;
...
@@ -659,7 +659,7 @@ drop table t1;
create
table
t2
(
create
table
t2
(
a
char
character
set
latin1
collate
latin1_swedish_ci
,
a
char
character
set
latin1
collate
latin1_swedish_ci
,
b
char
character
set
latin1
collate
latin1_
bin
);
b
char
character
set
latin1
collate
latin1_
german1_ci
);
--
error
1271
--
error
1271
create
table
t1
as
create
table
t1
as
(
select
a
from
t2
)
union
(
select
a
from
t2
)
union
...
...
sql/ha_innodb.cc
View file @
71f530c4
...
@@ -5380,6 +5380,32 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
...
@@ -5380,6 +5380,32 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
/*********************************************************************
Checks if ALTER TABLE may change the storage engine of the table.
Changing storage engines is not allowed for tables for which there
are foreign key constraints (parent or child tables). */
bool
ha_innobase
::
can_switch_engines
(
void
)
/*=================================*/
{
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
bool
can_switch
;
DBUG_ENTER
(
"ha_innobase::can_switch_engines"
);
prebuilt
->
trx
->
op_info
=
"determining if there are foreign key constraints"
;
row_mysql_lock_data_dictionary
(
prebuilt
->
trx
);
can_switch
=
!
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
referenced_list
)
&&
!
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
foreign_list
);
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
prebuilt
->
trx
->
op_info
=
""
;
DBUG_RETURN
(
can_switch
);
}
/***********************************************************************
/***********************************************************************
Checks if a table is referenced by a foreign key. The MySQL manual states that
Checks if a table is referenced by a foreign key. The MySQL manual states that
a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a
a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a
...
...
sql/ha_innodb.h
View file @
71f530c4
...
@@ -179,6 +179,7 @@ class ha_innobase: public handler
...
@@ -179,6 +179,7 @@ class ha_innobase: public handler
char
*
update_table_comment
(
const
char
*
comment
);
char
*
update_table_comment
(
const
char
*
comment
);
char
*
get_foreign_key_create_info
();
char
*
get_foreign_key_create_info
();
int
get_foreign_key_list
(
THD
*
thd
,
List
<
FOREIGN_KEY_INFO
>
*
f_key_list
);
int
get_foreign_key_list
(
THD
*
thd
,
List
<
FOREIGN_KEY_INFO
>
*
f_key_list
);
bool
can_switch_engines
();
uint
referenced_by_foreign_key
();
uint
referenced_by_foreign_key
();
void
free_foreign_key_create_info
(
char
*
str
);
void
free_foreign_key_create_info
(
char
*
str
);
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
THR_LOCK_DATA
**
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
...
...
sql/handler.h
View file @
71f530c4
...
@@ -671,6 +671,8 @@ class handler :public Sql_alloc
...
@@ -671,6 +671,8 @@ class handler :public Sql_alloc
virtual
void
append_create_info
(
String
*
packet
)
{}
virtual
void
append_create_info
(
String
*
packet
)
{}
virtual
char
*
get_foreign_key_create_info
()
virtual
char
*
get_foreign_key_create_info
()
{
return
(
NULL
);}
/* gets foreign key create string from InnoDB */
{
return
(
NULL
);}
/* gets foreign key create string from InnoDB */
/* used in ALTER TABLE; 1 if changing storage engine is allowed */
virtual
bool
can_switch_engines
()
{
return
1
;
}
/* used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
/* used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
virtual
int
get_foreign_key_list
(
THD
*
thd
,
List
<
FOREIGN_KEY_INFO
>
*
f_key_list
)
virtual
int
get_foreign_key_list
(
THD
*
thd
,
List
<
FOREIGN_KEY_INFO
>
*
f_key_list
)
{
return
0
;
}
{
return
0
;
}
...
...
sql/item.cc
View file @
71f530c4
...
@@ -936,8 +936,17 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
...
@@ -936,8 +936,17 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
set
(
0
,
DERIVATION_NONE
);
set
(
0
,
DERIVATION_NONE
);
return
1
;
return
1
;
}
}
if
(
collation
->
state
&
MY_CS_BINSORT
)
{
return
0
;
}
else
if
(
dt
.
collation
->
state
&
MY_CS_BINSORT
)
{
set
(
dt
);
return
0
;
}
CHARSET_INFO
*
bin
=
get_charset_by_csname
(
collation
->
csname
,
CHARSET_INFO
*
bin
=
get_charset_by_csname
(
collation
->
csname
,
MY_CS_BINSORT
,
MYF
(
0
));
MY_CS_BINSORT
,
MYF
(
0
));
set
(
bin
,
DERIVATION_NONE
);
set
(
bin
,
DERIVATION_NONE
);
}
}
}
}
...
...
sql/sql_table.cc
View file @
71f530c4
...
@@ -3302,6 +3302,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -3302,6 +3302,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Safety fix for innodb */
/* Safety fix for innodb */
if
(
lower_case_table_names
)
if
(
lower_case_table_names
)
my_casedn_str
(
files_charset_info
,
tmp_name
);
my_casedn_str
(
files_charset_info
,
tmp_name
);
if
(
new_db_type
!=
old_db_type
&&
!
table
->
file
->
can_switch_engines
())
{
my_error
(
ER_ROW_IS_REFERENCED
,
MYF
(
0
));
goto
err
;
}
create_info
->
db_type
=
new_db_type
;
create_info
->
db_type
=
new_db_type
;
if
(
!
create_info
->
comment
)
if
(
!
create_info
->
comment
)
create_info
->
comment
=
table
->
s
->
comment
;
create_info
->
comment
=
table
->
s
->
comment
;
...
...
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