Commit d4910623 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.9 into 10.10

parents 039d83b8 cd1de259
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1335 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# Run gcov and report test coverage on only those code lines touched by # Run gcov and report test coverage on only those code lines touched by
# a given list of commits. # a given list of commits.
......
...@@ -654,11 +654,11 @@ result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER S ...@@ -654,11 +654,11 @@ result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER S
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE DEFAULT CHARACTER SET utf8mb4 CHARACTER SET latin1 attrs COLLATE DEFAULT CHARACTER SET utf8mb4 CHARACTER SET latin1
result ERROR: COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1' result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 CHARACTER SET latin1 attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 CHARACTER SET latin1
result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1' result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 CHARACTER SET latin1 attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 CHARACTER SET latin1
...@@ -674,7 +674,7 @@ result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'C ...@@ -674,7 +674,7 @@ result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'C
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET utf8mb4 COLLATE DEFAULT CHARACTER SET latin1 attrs CHARACTER SET utf8mb4 COLLATE DEFAULT CHARACTER SET latin1
result ERROR: COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1' result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET latin1 attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET latin1
...@@ -694,7 +694,7 @@ result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1' ...@@ -694,7 +694,7 @@ result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin CHARACTER SET latin1 attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin CHARACTER SET latin1
result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1' result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE DEFAULT COLLATE utf8mb4_bin CHARACTER SET latin1 attrs COLLATE DEFAULT COLLATE utf8mb4_bin CHARACTER SET latin1
...@@ -774,7 +774,7 @@ result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER S ...@@ -774,7 +774,7 @@ result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER S
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE DEFAULT CHARACTER SET latin1 CHARACTER SET utf8mb4 attrs COLLATE DEFAULT CHARACTER SET latin1 CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE utf8mb4_bin CHARACTER SET latin1 CHARACTER SET utf8mb4 attrs COLLATE utf8mb4_bin CHARACTER SET latin1 CHARACTER SET utf8mb4
...@@ -782,11 +782,11 @@ result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1' ...@@ -782,11 +782,11 @@ result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 CHARACTER SET utf8mb4 attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET utf8mb4 attrs COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
...@@ -802,7 +802,7 @@ result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4' ...@@ -802,7 +802,7 @@ result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET latin1 COLLATE DEFAULT CHARACTER SET utf8mb4 attrs CHARACTER SET latin1 COLLATE DEFAULT CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET utf8mb4 attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET utf8mb4
...@@ -838,7 +838,7 @@ result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8 ...@@ -838,7 +838,7 @@ result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
...@@ -866,7 +866,7 @@ result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4' ...@@ -866,7 +866,7 @@ result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET latin1 COLLATE latin1_bin CHARACTER SET utf8mb4 attrs CHARACTER SET latin1 COLLATE latin1_bin CHARACTER SET utf8mb4
result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4' result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
query CREATE DATABASE query CREATE DATABASE
attrs CHARACTER SET utf8mb4 COLLATE latin1_bin CHARACTER SET utf8mb4 attrs CHARACTER SET utf8mb4 COLLATE latin1_bin CHARACTER SET utf8mb4
......
...@@ -104,3 +104,27 @@ DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME ...@@ -104,3 +104,27 @@ DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
utf8mb4 utf8mb4_bin utf8mb4 utf8mb4_bin
DROP DATABASE db1; DROP DATABASE db1;
DROP VIEW cscl; DROP VIEW cscl;
#
# MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
#
CREATE DATABASE db1 COLLATE latin1_swedish_ci COLLATE latin1_bin;
ERROR HY000: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
#
# MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
#
SET collation_server=utf8mb4_unicode_ci;
CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
SET collation_server=DEFAULT;
CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
DROP DATABASE db1;
CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
DROP DATABASE db1;
...@@ -94,3 +94,31 @@ SELECT * FROM cscl; ...@@ -94,3 +94,31 @@ SELECT * FROM cscl;
DROP DATABASE db1; DROP DATABASE db1;
DROP VIEW cscl; DROP VIEW cscl;
--echo #
--echo # MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
--echo #
--error ER_CONFLICTING_DECLARATIONS
CREATE DATABASE db1 COLLATE latin1_swedish_ci COLLATE latin1_bin;
--echo #
--echo # MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
--echo #
SET collation_server=utf8mb4_unicode_ci;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
SET collation_server=DEFAULT;
CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
SHOW CREATE DATABASE db1;
DROP DATABASE db1;
CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
SHOW CREATE DATABASE db1;
DROP DATABASE db1;
...@@ -25,3 +25,33 @@ t1 CREATE TABLE `t1` ( ...@@ -25,3 +25,33 @@ t1 CREATE TABLE `t1` (
`a` char(10) DEFAULT NULL `a` char(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
#
CREATE TABLE t1 (a CHAR(10)) COLLATE latin1_swedish_ci COLLATE latin1_bin;
ERROR HY000: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
#
# MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
#
CREATE DATABASE db1 CHARACTER SET utf8mb4;
USE db1;
CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
DROP DATABASE db1;
USE test;
CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
DROP TABLE t1;
CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
DROP TABLE t1;
...@@ -20,3 +20,32 @@ DROP TABLE t1; ...@@ -20,3 +20,32 @@ DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf8mb4 COLLATE DEFAULT; CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf8mb4 COLLATE DEFAULT;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
--echo #
--error ER_CONFLICTING_DECLARATIONS
CREATE TABLE t1 (a CHAR(10)) COLLATE latin1_swedish_ci COLLATE latin1_bin;
--echo #
--echo # MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
--echo #
CREATE DATABASE db1 CHARACTER SET utf8mb4;
USE db1;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
--error ER_COLLATION_CHARSET_MISMATCH
CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
DROP DATABASE db1;
USE test;
CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
SHOW CREATE TABLE t1;
DROP TABLE t1;
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1335 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER #define MYSQL_SERVER
#include <my_global.h> #include <my_global.h>
......
...@@ -72,6 +72,20 @@ bool Lex_exact_charset:: ...@@ -72,6 +72,20 @@ bool Lex_exact_charset::
} }
bool Lex_exact_charset_opt_extended_collate::
raise_if_charsets_differ(const Lex_exact_charset &cs) const
{
if (!my_charset_same(m_ci, cs.charset_info()))
{
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
"CHARACTER SET ", m_ci->cs_name.str,
"CHARACTER SET ", cs.charset_info()->cs_name.str);
return true;
}
return false;
}
bool Lex_exact_charset_opt_extended_collate:: bool Lex_exact_charset_opt_extended_collate::
raise_if_not_applicable(const Lex_exact_collation &cl) const raise_if_not_applicable(const Lex_exact_collation &cl) const
{ {
...@@ -386,8 +400,7 @@ CHARSET_INFO *Lex_exact_charset_extended_collation_attrs_st:: ...@@ -386,8 +400,7 @@ CHARSET_INFO *Lex_exact_charset_extended_collation_attrs_st::
case TYPE_EMPTY: case TYPE_EMPTY:
return def; return def;
case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET:
DBUG_ASSERT(m_ci); case TYPE_CHARACTER_SET_COLLATE_EXACT:
return m_ci;
case TYPE_COLLATE_EXACT: case TYPE_COLLATE_EXACT:
DBUG_ASSERT(m_ci); DBUG_ASSERT(m_ci);
return m_ci; return m_ci;
...@@ -418,11 +431,13 @@ bool Lex_exact_charset_extended_collation_attrs_st:: ...@@ -418,11 +431,13 @@ bool Lex_exact_charset_extended_collation_attrs_st::
case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET:
{ {
// CHARACTER SET latin1 .. COLLATE latin1_swedish_ci // CHARACTER SET latin1 .. COLLATE latin1_swedish_ci
if (Lex_exact_charset(m_ci).raise_if_not_applicable(cl)) Lex_exact_charset_opt_extended_collate tmp(m_ci, false);
if (tmp.merge_exact_collation(cl))
return true; return true;
*this= Lex_exact_charset_extended_collation_attrs(cl); *this= Lex_exact_charset_extended_collation_attrs(tmp);
return false; return false;
} }
case TYPE_CHARACTER_SET_COLLATE_EXACT:
case TYPE_COLLATE_EXACT: case TYPE_COLLATE_EXACT:
{ {
// [CHARACTER SET latin1] COLLATE latin1_bin .. COLLATE latin1_bin // [CHARACTER SET latin1] COLLATE latin1_bin .. COLLATE latin1_bin
...@@ -460,9 +475,10 @@ bool Lex_exact_charset_extended_collation_attrs_st:: ...@@ -460,9 +475,10 @@ bool Lex_exact_charset_extended_collation_attrs_st::
Lex_exact_charset_opt_extended_collate tmp(m_ci, false); Lex_exact_charset_opt_extended_collate tmp(m_ci, false);
if (tmp.merge_context_collation(cl)) if (tmp.merge_context_collation(cl))
return true; return true;
*this= Lex_exact_charset_extended_collation_attrs(tmp.collation()); *this= Lex_exact_charset_extended_collation_attrs(tmp);
return false; return false;
} }
case TYPE_CHARACTER_SET_COLLATE_EXACT:
case TYPE_COLLATE_EXACT: case TYPE_COLLATE_EXACT:
// [CHARACTER SET latin1] COLLATE latin1_swedish_ci .. COLLATE DEFAULT // [CHARACTER SET latin1] COLLATE latin1_swedish_ci .. COLLATE DEFAULT
return Lex_exact_collation(m_ci). return Lex_exact_collation(m_ci).
...@@ -538,7 +554,15 @@ bool Lex_exact_charset_extended_collation_attrs_st:: ...@@ -538,7 +554,15 @@ bool Lex_exact_charset_extended_collation_attrs_st::
case TYPE_COLLATE_EXACT: case TYPE_COLLATE_EXACT:
// COLLATE latin1_bin .. CHARACTER SET cs // COLLATE latin1_bin .. CHARACTER SET cs
return cs.raise_if_not_applicable(Lex_exact_collation(m_ci)); if (cs.raise_if_not_applicable(Lex_exact_collation(m_ci)))
return true;
m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
return false;
case TYPE_CHARACTER_SET_COLLATE_EXACT:
// CHARACTER SET cs1 COLLATE cl .. CHARACTER SET cs2
return Lex_exact_charset_opt_extended_collate(m_ci, true).
raise_if_charsets_differ(cs);
case TYPE_COLLATE_CONTEXTUALLY_TYPED: case TYPE_COLLATE_CONTEXTUALLY_TYPED:
// COLLATE DEFAULT .. CHARACTER SET cs // COLLATE DEFAULT .. CHARACTER SET cs
...@@ -546,7 +570,7 @@ bool Lex_exact_charset_extended_collation_attrs_st:: ...@@ -546,7 +570,7 @@ bool Lex_exact_charset_extended_collation_attrs_st::
Lex_exact_charset_opt_extended_collate tmp(cs); Lex_exact_charset_opt_extended_collate tmp(cs);
if (tmp.merge_context_collation(Lex_context_collation(m_ci))) if (tmp.merge_context_collation(Lex_context_collation(m_ci)))
return true; return true;
*this= Lex_exact_charset_extended_collation_attrs(tmp.collation()); *this= Lex_exact_charset_extended_collation_attrs(tmp);
return false; return false;
} }
} }
...@@ -567,7 +591,6 @@ bool Lex_extended_charset_extended_collation_attrs_st::merge_charset_default() ...@@ -567,7 +591,6 @@ bool Lex_extended_charset_extended_collation_attrs_st::merge_charset_default()
bool Lex_extended_charset_extended_collation_attrs_st:: bool Lex_extended_charset_extended_collation_attrs_st::
merge_exact_charset(const Lex_exact_charset &cs) merge_exact_charset(const Lex_exact_charset &cs)
{ {
m_had_charset_exact= true;
if (m_charset_order == CHARSET_TYPE_EMPTY) if (m_charset_order == CHARSET_TYPE_EMPTY)
m_charset_order= CHARSET_TYPE_EXACT; m_charset_order= CHARSET_TYPE_EXACT;
return Lex_exact_charset_extended_collation_attrs_st::merge_exact_charset(cs); return Lex_exact_charset_extended_collation_attrs_st::merge_exact_charset(cs);
...@@ -621,6 +644,7 @@ Lex_extended_charset_extended_collation_attrs_st:: ...@@ -621,6 +644,7 @@ Lex_extended_charset_extended_collation_attrs_st::
} }
return m_ci; return m_ci;
case TYPE_CHARACTER_SET_COLLATE_EXACT:
case TYPE_COLLATE_EXACT: case TYPE_COLLATE_EXACT:
{ {
/* /*
...@@ -629,7 +653,7 @@ Lex_extended_charset_extended_collation_attrs_st:: ...@@ -629,7 +653,7 @@ Lex_extended_charset_extended_collation_attrs_st::
[ CHARACTER SET cs_exact ] [ CHARACTER SET cs_exact ]
CHARACTER SET DEFAULT; CHARACTER SET DEFAULT;
*/ */
if (m_had_charset_exact && if (m_type == TYPE_CHARACTER_SET_COLLATE_EXACT &&
raise_if_charset_conflicts_with_default(ctx.charset_default())) raise_if_charset_conflicts_with_default(ctx.charset_default()))
{ {
/* /*
......
...@@ -203,6 +203,7 @@ class Lex_exact_charset_opt_extended_collate ...@@ -203,6 +203,7 @@ class Lex_exact_charset_opt_extended_collate
bool with_collate() const { return m_with_collate; } bool with_collate() const { return m_with_collate; }
CHARSET_INFO *find_bin_collation() const; CHARSET_INFO *find_bin_collation() const;
CHARSET_INFO *find_default_collation() const; CHARSET_INFO *find_default_collation() const;
bool raise_if_charsets_differ(const Lex_exact_charset &cs) const;
bool raise_if_not_applicable(const Lex_exact_collation &cl) const; bool raise_if_not_applicable(const Lex_exact_collation &cl) const;
/* /*
Add another COLLATE clause (exact or context). Add another COLLATE clause (exact or context).
...@@ -281,13 +282,16 @@ struct Lex_exact_charset_extended_collation_attrs_st ...@@ -281,13 +282,16 @@ struct Lex_exact_charset_extended_collation_attrs_st
TYPE_EMPTY= 0, TYPE_EMPTY= 0,
TYPE_CHARACTER_SET= 1, TYPE_CHARACTER_SET= 1,
TYPE_COLLATE_EXACT= 2, TYPE_COLLATE_EXACT= 2,
TYPE_COLLATE_CONTEXTUALLY_TYPED= 3 TYPE_CHARACTER_SET_COLLATE_EXACT= 3,
TYPE_COLLATE_CONTEXTUALLY_TYPED= 4
}; };
// Number of bits required to store enum Type values // Number of bits required to store enum Type values
#define LEX_CHARSET_COLLATION_TYPE_BITS 2 #define LEX_CHARSET_COLLATION_TYPE_BITS 3
static_assert(((1<<LEX_CHARSET_COLLATION_TYPE_BITS)-1) >= #define LEX_CHARSET_COLLATION_TYPE_MASK ((1<<LEX_CHARSET_COLLATION_TYPE_BITS)-1)
static_assert(LEX_CHARSET_COLLATION_TYPE_MASK >=
TYPE_COLLATE_CONTEXTUALLY_TYPED, TYPE_COLLATE_CONTEXTUALLY_TYPED,
"Lex_exact_charset_extended_collation_attrs_st::Type bits"); "Lex_exact_charset_extended_collation_attrs_st::Type bits");
...@@ -330,37 +334,37 @@ struct Lex_exact_charset_extended_collation_attrs_st ...@@ -330,37 +334,37 @@ struct Lex_exact_charset_extended_collation_attrs_st
} }
void init(const Lex_exact_charset_opt_extended_collate &cscl) void init(const Lex_exact_charset_opt_extended_collate &cscl)
{ {
cscl.with_collate() ? init(cscl.collation()) : if (cscl.with_collate())
init(cscl.collation().charset_info(), TYPE_CHARACTER_SET_COLLATE_EXACT);
else
init(cscl.charset()); init(cscl.charset());
} }
bool is_empty() const bool is_empty() const
{ {
return m_type == TYPE_EMPTY; return m_type == TYPE_EMPTY;
} }
void set_charset(CHARSET_INFO *cs) void set_charset(const Lex_exact_charset &cs)
{ {
DBUG_ASSERT(cs); m_ci= cs.charset_info();
m_ci= cs;
m_type= TYPE_CHARACTER_SET; m_type= TYPE_CHARACTER_SET;
} }
bool set_charset_collate_default(CHARSET_INFO *cs) bool set_charset_collate_default(const Lex_exact_charset &cs)
{ {
DBUG_ASSERT(cs); CHARSET_INFO *ci;
if (!(cs= Lex_exact_charset_opt_extended_collate(cs, true). if (!(ci= Lex_exact_charset_opt_extended_collate(cs).
find_default_collation())) find_default_collation()))
return true; return true;
m_ci= cs; m_ci= ci;
m_type= TYPE_COLLATE_EXACT; m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
return false; return false;
} }
bool set_charset_collate_binary(CHARSET_INFO *cs) bool set_charset_collate_binary(const Lex_exact_charset &cs)
{ {
DBUG_ASSERT(cs); CHARSET_INFO *ci;
if (!(cs= Lex_exact_charset_opt_extended_collate(cs, true). if (!(ci= Lex_exact_charset_opt_extended_collate(cs).find_bin_collation()))
find_bin_collation()))
return true; return true;
m_ci= cs; m_ci= ci;
m_type= TYPE_COLLATE_EXACT; m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
return false; return false;
} }
void set_collate_default() void set_collate_default()
...@@ -407,6 +411,7 @@ struct Lex_exact_charset_extended_collation_attrs_st ...@@ -407,6 +411,7 @@ struct Lex_exact_charset_extended_collation_attrs_st
return merge_exact_collation(Lex_exact_collation(cl.charset_info())); return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
case TYPE_COLLATE_CONTEXTUALLY_TYPED: case TYPE_COLLATE_CONTEXTUALLY_TYPED:
case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET:
case TYPE_CHARACTER_SET_COLLATE_EXACT:
break; break;
} }
DBUG_ASSERT(0); DBUG_ASSERT(0);
...@@ -430,6 +435,7 @@ struct Lex_exact_charset_extended_collation_attrs_st ...@@ -430,6 +435,7 @@ struct Lex_exact_charset_extended_collation_attrs_st
return merge_exact_collation(Lex_exact_collation(cl.charset_info())); return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
case TYPE_COLLATE_CONTEXTUALLY_TYPED: case TYPE_COLLATE_CONTEXTUALLY_TYPED:
case TYPE_CHARACTER_SET: case TYPE_CHARACTER_SET:
case TYPE_CHARACTER_SET_COLLATE_EXACT:
break; break;
} }
DBUG_ASSERT(0); DBUG_ASSERT(0);
...@@ -527,33 +533,18 @@ class Lex_extended_charset_extended_collation_attrs_st: ...@@ -527,33 +533,18 @@ class Lex_extended_charset_extended_collation_attrs_st:
order of CHARACTER SET clauses in case of conflicts. order of CHARACTER SET clauses in case of conflicts.
*/ */
charset_type_t m_charset_order; charset_type_t m_charset_order;
/*
The parent class Lex_exact_charset_extended_collation_attrs_st
does not let know if a "COLLATE cl_exact" was used in combination with
"CHARACTER SET cs_exact" or just alone.
Here we need to distinguish:
- CHARACTER SET cs_exact COLLATE cl_exact, or
- COLLATE cl_exact CHARACTER SET cs_exact
versus just:
- COLLATE cl_exact
to produce better error messages in case of conflicts.
So let's add a flag member:
*/
bool m_had_charset_exact;
public: public:
void init() void init()
{ {
Lex_opt_context_charset_st::init(); Lex_opt_context_charset_st::init();
Lex_exact_charset_extended_collation_attrs_st::init(); Lex_exact_charset_extended_collation_attrs_st::init();
m_charset_order= CHARSET_TYPE_EMPTY; m_charset_order= CHARSET_TYPE_EMPTY;
m_had_charset_exact= false;
} }
void init(const Lex_exact_charset_opt_extended_collate &c) void init(const Lex_exact_charset_opt_extended_collate &c)
{ {
Lex_opt_context_charset_st::init(); Lex_opt_context_charset_st::init();
Lex_exact_charset_extended_collation_attrs_st::init(c); Lex_exact_charset_extended_collation_attrs_st::init(c);
m_charset_order= CHARSET_TYPE_EXACT; m_charset_order= CHARSET_TYPE_EXACT;
m_had_charset_exact= true;
} }
bool is_empty() const bool is_empty() const
{ {
......
...@@ -6506,22 +6506,28 @@ opt_binary: ...@@ -6506,22 +6506,28 @@ opt_binary:
; ;
binary: binary:
BYTE_SYM { $$.set_charset(&my_charset_bin); } BYTE_SYM
| charset_or_alias { $$.set_charset($1); } {
$$.set_charset(Lex_exact_charset(&my_charset_bin));
}
| charset_or_alias
{
$$.set_charset(Lex_exact_charset($1));
}
| charset_or_alias BINARY | charset_or_alias BINARY
{ {
if ($$.set_charset_collate_binary($1)) if ($$.set_charset_collate_binary(Lex_exact_charset($1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| BINARY { $$.set_contextually_typed_binary_style(); } | BINARY { $$.set_contextually_typed_binary_style(); }
| BINARY charset_or_alias | BINARY charset_or_alias
{ {
if ($$.set_charset_collate_binary($2)) if ($$.set_charset_collate_binary(Lex_exact_charset($2)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| charset_or_alias COLLATE_SYM DEFAULT | charset_or_alias COLLATE_SYM DEFAULT
{ {
$$.set_charset_collate_default($1); $$.set_charset_collate_default(Lex_exact_charset($1));
} }
| charset_or_alias COLLATE_SYM collation_name | charset_or_alias COLLATE_SYM collation_name
{ {
......
...@@ -704,7 +704,9 @@ struct Lex_field_type_st: public Lex_length_and_dec_st ...@@ -704,7 +704,9 @@ struct Lex_field_type_st: public Lex_length_and_dec_st
m_handler= handler; m_handler= handler;
m_ci= coll.charset_info(); m_ci= coll.charset_info();
Lex_length_and_dec_st::operator=(length_and_dec); Lex_length_and_dec_st::operator=(length_and_dec);
m_collation_type= ((uint8) coll.type()) & 0x3; // Using bit-and to avoid the warning:
// conversion from ‘uint8’ to ‘unsigned char:3’ may change value
m_collation_type= ((uint8) coll.type()) & LEX_CHARSET_COLLATION_TYPE_MASK;
} }
void set(const Type_handler *handler, void set(const Type_handler *handler,
const Lex_column_charset_collation_attrs_st &coll) const Lex_column_charset_collation_attrs_st &coll)
...@@ -712,7 +714,9 @@ struct Lex_field_type_st: public Lex_length_and_dec_st ...@@ -712,7 +714,9 @@ struct Lex_field_type_st: public Lex_length_and_dec_st
m_handler= handler; m_handler= handler;
m_ci= coll.charset_info(); m_ci= coll.charset_info();
Lex_length_and_dec_st::reset(); Lex_length_and_dec_st::reset();
m_collation_type= ((uint8) coll.type()) & 0x3; // Using bit-and to avoid the warning:
// conversion from ‘uint8’ to ‘unsigned char:3’ may change value
m_collation_type= ((uint8) coll.type()) & LEX_CHARSET_COLLATION_TYPE_MASK;
} }
void set(const Type_handler *handler, CHARSET_INFO *cs= NULL) void set(const Type_handler *handler, CHARSET_INFO *cs= NULL)
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "wsrep_trans_observer.h" #include "wsrep_trans_observer.h"
#include "wsrep_mysqld.h" #include "wsrep_mysqld.h"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef WSREP_TRANS_OBSERVER_H #ifndef WSREP_TRANS_OBSERVER_H
#define WSREP_TRANS_OBSERVER_H #define WSREP_TRANS_OBSERVER_H
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1 #define MYSQL_SERVER 1
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* C++ standard header files */ /* C++ standard header files */
#include <array> #include <array>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h> #include <my_global.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#pragma once #pragma once
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* MyRocks global type definitions goes here */ /* MyRocks global type definitions goes here */
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1 #define MYSQL_SERVER 1
#include <my_global.h> #include <my_global.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
Define functionality offered by MySQL or MariaDB Define functionality offered by MySQL or MariaDB
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1 #define MYSQL_SERVER 1
#include <my_global.h> #include <my_global.h>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
class spider_group_by_handler: public group_by_handler class spider_group_by_handler: public group_by_handler
{ {
......
...@@ -634,7 +634,6 @@ typedef struct st_spider_transaction ...@@ -634,7 +634,6 @@ typedef struct st_spider_transaction
bool updated_in_this_trx; bool updated_in_this_trx;
THD *thd; THD *thd;
my_hash_value_type thd_hash_value;
XID xid; XID xid;
HASH trx_conn_hash; HASH trx_conn_hash;
uint trx_conn_hash_id; uint trx_conn_hash_id;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* /*
This SQL script creates system tables for SPIDER This SQL script creates system tables for SPIDER
......
...@@ -1247,11 +1247,6 @@ SPIDER_TRX *spider_get_trx( ...@@ -1247,11 +1247,6 @@ SPIDER_TRX *spider_get_trx(
trx->trx_ha_hash.array.size_of_element); trx->trx_ha_hash.array.size_of_element);
trx->thd = (THD*) thd; trx->thd = (THD*) thd;
if (thd)
trx->thd_hash_value = my_calc_hash(&spider_allocated_thds,
(uchar*) thd, sizeof(THD *));
else
trx->thd_hash_value = 0;
pthread_mutex_lock(&spider_thread_id_mutex); pthread_mutex_lock(&spider_thread_id_mutex);
trx->spider_thread_id = spider_thread_id; trx->spider_thread_id = spider_thread_id;
++spider_thread_id; ++spider_thread_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment