non-functional cleanup, clarifying CONVERT_IF_BIGGER_TO_BLOB
This commit is contained in:
parent
ac45f3b38a
commit
78d9fdb134
@ -1140,6 +1140,14 @@ id l
|
|||||||
a 512
|
a 512
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||||
|
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
|
||||||
|
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
|
||||||
|
id l
|
||||||
|
a 512
|
||||||
|
Warnings:
|
||||||
|
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||||
#
|
#
|
||||||
# End of 5.5 tests
|
# End of 5.5 tests
|
||||||
#
|
#
|
||||||
|
@ -5055,6 +5055,14 @@ id l
|
|||||||
a 1024
|
a 1024
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||||
|
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
|
||||||
|
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
|
||||||
|
id l
|
||||||
|
a 1024
|
||||||
|
Warnings:
|
||||||
|
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||||
#
|
#
|
||||||
# End of 5.5 tests
|
# End of 5.5 tests
|
||||||
#
|
#
|
||||||
|
@ -777,6 +777,10 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
|
|||||||
GROUP BY id
|
GROUP BY id
|
||||||
ORDER BY l DESC;
|
ORDER BY l DESC;
|
||||||
|
|
||||||
|
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
|
||||||
|
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
## TODO: add tests for all engines
|
## TODO: add tests for all engines
|
||||||
|
@ -1590,6 +1590,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
|
|||||||
GROUP BY id
|
GROUP BY id
|
||||||
ORDER BY l DESC;
|
ORDER BY l DESC;
|
||||||
|
|
||||||
|
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
|
||||||
|
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.5 tests
|
--echo # End of 5.5 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -375,7 +375,7 @@ select group_concat('x') UNION ALL select 1;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #12863 : missing separators after first empty cancatanated elements
|
# Bug #12863 : missing separators after first empty concatenated elements
|
||||||
#
|
#
|
||||||
|
|
||||||
CREATE TABLE t1 (id int, a varchar(9));
|
CREATE TABLE t1 (id int, a varchar(9));
|
||||||
|
@ -5579,7 +5579,7 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
|
|||||||
/**
|
/**
|
||||||
Create a field to hold a string value from an item.
|
Create a field to hold a string value from an item.
|
||||||
|
|
||||||
If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob @n
|
If too_big_for_varchar() create a blob @n
|
||||||
If max_length > 0 create a varchar @n
|
If max_length > 0 create a varchar @n
|
||||||
If max_length == 0 create a CHAR(0)
|
If max_length == 0 create a CHAR(0)
|
||||||
|
|
||||||
@ -5594,7 +5594,7 @@ Field *Item::make_string_field(TABLE *table)
|
|||||||
Note: the following check is repeated in
|
Note: the following check is repeated in
|
||||||
subquery_types_allow_materialization():
|
subquery_types_allow_materialization():
|
||||||
*/
|
*/
|
||||||
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
|
if (too_big_for_varchar())
|
||||||
field= new Field_blob(max_length, maybe_null, name,
|
field= new Field_blob(max_length, maybe_null, name,
|
||||||
collation.collation, TRUE);
|
collation.collation, TRUE);
|
||||||
/* Item_type_holder holds the exact type, do not change it */
|
/* Item_type_holder holds the exact type, do not change it */
|
||||||
@ -5699,7 +5699,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
|
|||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
/* If something goes awfully wrong, it's better to get a string than die */
|
/* If something goes awfully wrong, it's better to get a string than die */
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
if (fixed_length && max_length < CONVERT_IF_BIGGER_TO_BLOB)
|
if (fixed_length && !too_big_for_varchar())
|
||||||
{
|
{
|
||||||
field= new Field_string(max_length, maybe_null, name,
|
field= new Field_string(max_length, maybe_null, name,
|
||||||
collation.collation);
|
collation.collation);
|
||||||
|
@ -1424,6 +1424,8 @@ public:
|
|||||||
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
|
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
|
||||||
uint32 max_char_length() const
|
uint32 max_char_length() const
|
||||||
{ return max_length / collation.collation->mbmaxlen; }
|
{ return max_length / collation.collation->mbmaxlen; }
|
||||||
|
bool too_big_for_varchar() const
|
||||||
|
{ return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; }
|
||||||
void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
|
void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen);
|
max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen);
|
||||||
|
@ -1439,7 +1439,7 @@ public:
|
|||||||
virtual Field *make_string_field(TABLE *table);
|
virtual Field *make_string_field(TABLE *table);
|
||||||
enum_field_types field_type() const
|
enum_field_types field_type() const
|
||||||
{
|
{
|
||||||
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
|
if (too_big_for_varchar())
|
||||||
return MYSQL_TYPE_BLOB;
|
return MYSQL_TYPE_BLOB;
|
||||||
else
|
else
|
||||||
return MYSQL_TYPE_VARCHAR;
|
return MYSQL_TYPE_VARCHAR;
|
||||||
|
@ -853,8 +853,7 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
|
|||||||
create a blob column because item->max_length is too big.
|
create a blob column because item->max_length is too big.
|
||||||
The following check is copied from Item::make_string_field():
|
The following check is copied from Item::make_string_field():
|
||||||
*/
|
*/
|
||||||
if (inner->max_length / inner->collation.collation->mbmaxlen >
|
if (inner->too_big_for_varchar())
|
||||||
CONVERT_IF_BIGGER_TO_BLOB)
|
|
||||||
{
|
{
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
@ -3865,6 +3864,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
|
|||||||
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||||
|
|
||||||
/* STEP 2: Figure if we'll be using a key or blob+constraint */
|
/* STEP 2: Figure if we'll be using a key or blob+constraint */
|
||||||
|
/* it always has my_charset_bin, so mbmaxlen==1 */
|
||||||
if (uniq_tuple_length_arg >= CONVERT_IF_BIGGER_TO_BLOB)
|
if (uniq_tuple_length_arg >= CONVERT_IF_BIGGER_TO_BLOB)
|
||||||
using_unique_constraint= TRUE;
|
using_unique_constraint= TRUE;
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
#define MAX_MBWIDTH 3 /* Max multibyte sequence */
|
#define MAX_MBWIDTH 3 /* Max multibyte sequence */
|
||||||
#define MAX_FIELD_CHARLENGTH 255
|
#define MAX_FIELD_CHARLENGTH 255
|
||||||
#define MAX_FIELD_VARCHARLENGTH 65535
|
#define MAX_FIELD_VARCHARLENGTH 65535
|
||||||
#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
|
#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
|
||||||
#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */
|
#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */
|
||||||
|
|
||||||
/* Max column width +1 */
|
/* Max column width +1 */
|
||||||
#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
|
#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
|
||||||
|
@ -14185,7 +14185,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
|
|||||||
can't index BIT fields.
|
can't index BIT fields.
|
||||||
*/
|
*/
|
||||||
(*tmp->item)->marker=4; // Store null in key
|
(*tmp->item)->marker=4; // Store null in key
|
||||||
if ((*tmp->item)->max_length >= CONVERT_IF_BIGGER_TO_BLOB)
|
if ((*tmp->item)->too_big_for_varchar())
|
||||||
using_unique_constraint=1;
|
using_unique_constraint=1;
|
||||||
}
|
}
|
||||||
if (param->group_length >= MAX_BLOB_WIDTH)
|
if (param->group_length >= MAX_BLOB_WIDTH)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user