2699
2699
errmsg_printf(ERRMSG_LVL_ERROR, _("Incorrect definition of table %s.%s: "
2700
2700
"expected column '%s' at position %d, found '%s'."),
2701
2701
s->db.str, alias, table_def->name.str, i,
2702
cur_field->field_name);
2704
field->sql_type(sql_type);
2704
cur_field->sql_type(sql_type);
2706
2706
Generally, if column types don't match, then something is
2722
2722
if (strncmp(sql_type.c_ptr_safe(), table_def->type.str,
2723
2723
table_def->type.length - 1))
2725
errmsg_printf(ERRMSG_LVL_ERROR, _("Incorrect definition of table %s.%s: "
2725
errmsg_printf(ERRMSG_LVL_ERROR,
2726
_("Incorrect definition of table %s.%s: "
2726
2727
"expected column '%s' at position %d to have type "
2727
"%s, found type %s."), s->db.str, alias,
2728
table_def->name.str, i, table_def->type.str,
2729
sql_type.c_ptr_safe());
2728
"%s, found type %s."),
2730
table_def->name.str, i, table_def->type.str,
2731
sql_type.c_ptr_safe());
2732
else if (table_def->cset.str && !field->has_charset())
2734
else if (table_def->cset.str && !cur_field->has_charset())
2734
errmsg_printf(ERRMSG_LVL_ERROR, _("Incorrect definition of table %s.%s: "
2736
errmsg_printf(ERRMSG_LVL_ERROR,
2737
_("Incorrect definition of table %s.%s: "
2735
2738
"expected the type of column '%s' at position %d "
2736
2739
"to have character set '%s' but the type has no "
2737
"character set."), s->db.str, alias,
2738
table_def->name.str, i, table_def->cset.str);
2742
table_def->name.str, i, table_def->cset.str);
2741
2745
else if (table_def->cset.str &&
2742
strcmp(field->charset()->csname, table_def->cset.str))
2746
strcmp(cur_field->charset()->csname, table_def->cset.str))
2744
errmsg_printf(ERRMSG_LVL_ERROR, _("Incorrect definition of table %s.%s: "
2748
errmsg_printf(ERRMSG_LVL_ERROR,
2749
_("Incorrect definition of table %s.%s: "
2745
2750
"expected the type of column '%s' at position %d "
2746
2751
"to have character set '%s' but found "
2747
"character set '%s'."), s->db.str, alias,
2748
table_def->name.str, i, table_def->cset.str,
2749
field->charset()->csname);
2752
"character set '%s'."),
2754
table_def->name.str, i, table_def->cset.str,
2755
cur_field->charset()->csname);
2755
errmsg_printf(ERRMSG_LVL_ERROR, _("Incorrect definition of table %s.%s: "
2761
errmsg_printf(ERRMSG_LVL_ERROR,
2762
_("Incorrect definition of table %s.%s: "
2756
2763
"expected column '%s' at position %d to have type %s "
2757
2764
" but the column is not found."),
2759
table_def->name.str, i, table_def->type.str);
2766
table_def->name.str, i, table_def->type.str);
4574
4581
for (uint32_t i=0; i < keyinfo->key_parts ; i++,seg++)
4576
Field *field=keyinfo->key_part[i].field;
4583
Field *key_field=keyinfo->key_part[i].field;
4578
seg->language= field->charset()->number;
4585
seg->language= key_field->charset()->number;
4579
4586
seg->length= keyinfo->key_part[i].length;
4580
4587
seg->start= keyinfo->key_part[i].offset;
4581
if (field->flags & BLOB_FLAG)
4588
if (key_field->flags & BLOB_FLAG)
4584
4591
((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ?
4585
4592
HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2);
4586
seg->bit_start= (uint8_t)(field->pack_length() - share->blob_ptr_size);
4593
seg->bit_start= (uint8_t)(key_field->pack_length()
4594
- share->blob_ptr_size);
4587
4595
seg->flag= HA_BLOB_PART;
4588
4596
seg->length=0; // Whole blob in unique constraint
4592
4600
seg->type= keyinfo->key_part[i].type;
4594
if (!(field->flags & NOT_NULL_FLAG))
4602
if (!(key_field->flags & NOT_NULL_FLAG))
4596
seg->null_bit= field->null_bit;
4597
seg->null_pos= (uint) (field->null_ptr - (unsigned char*) record[0]);
4604
seg->null_bit= key_field->null_bit;
4605
seg->null_pos= (uint) (key_field->null_ptr - (unsigned char*) record[0]);
4599
4607
We are using a GROUP BY on something that contains NULL
4600
4608
In this case we have to tell MyISAM that two NULL should