2263
table_check_intact(Table *table, const uint table_f_count,
2264
const TABLE_FIELD_W_TYPE *table_def)
2263
Table::table_check_intact(const uint table_f_count,
2264
const TABLE_FIELD_W_TYPE *table_def)
2267
2267
bool error= false;
2268
2268
bool fields_diff_count;
2270
fields_diff_count= (table->s->fields != table_f_count);
2270
fields_diff_count= (s->fields != table_f_count);
2271
2271
if (fields_diff_count)
2274
2274
/* previous MySQL version */
2275
if (DRIZZLE_VERSION_ID > table->s->mysql_version)
2275
if (DRIZZLE_VERSION_ID > s->mysql_version)
2277
2277
sql_print_error(ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
2278
table->alias, table_f_count, table->s->fields,
2279
table->s->mysql_version, DRIZZLE_VERSION_ID);
2278
alias, table_f_count, s->fields,
2279
s->mysql_version, DRIZZLE_VERSION_ID);
2282
else if (DRIZZLE_VERSION_ID == table->s->mysql_version)
2282
else if (DRIZZLE_VERSION_ID == s->mysql_version)
2284
sql_print_error(ER(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED), table->alias,
2285
table_f_count, table->s->fields);
2284
sql_print_error(ER(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED), alias,
2285
table_f_count, s->fields);
2299
2299
String sql_type(buffer, sizeof(buffer), system_charset_info);
2300
2300
sql_type.length(0);
2301
if (i < table->s->fields)
2303
Field *field= table->field[i];
2303
Field *field= this->field[i];
2305
2305
if (strncmp(field->field_name, table_def->name.str,
2306
2306
table_def->name.length))
2313
2313
sql_print_error(_("Incorrect definition of table %s.%s: "
2314
2314
"expected column '%s' at position %d, found '%s'."),
2315
table->s->db.str, table->alias, table_def->name.str, i,
2315
s->db.str, alias, table_def->name.str, i,
2316
2316
field->field_name);
2318
2318
field->sql_type(sql_type);
2339
2339
sql_print_error(_("Incorrect definition of table %s.%s: "
2340
2340
"expected column '%s' at position %d to have type "
2341
"%s, found type %s."), table->s->db.str, table->alias,
2341
"%s, found type %s."), s->db.str, alias,
2342
2342
table_def->name.str, i, table_def->type.str,
2343
2343
sql_type.c_ptr_safe());
2348
2348
sql_print_error(_("Incorrect definition of table %s.%s: "
2349
2349
"expected the type of column '%s' at position %d "
2350
2350
"to have character set '%s' but the type has no "
2351
"character set."), table->s->db.str, table->alias,
2351
"character set."), s->db.str, alias,
2352
2352
table_def->name.str, i, table_def->cset.str);
2358
2358
sql_print_error(_("Incorrect definition of table %s.%s: "
2359
2359
"expected the type of column '%s' at position %d "
2360
2360
"to have character set '%s' but found "
2361
"character set '%s'."), table->s->db.str, table->alias,
2361
"character set '%s'."), s->db.str, alias,
2362
2362
table_def->name.str, i, table_def->cset.str,
2363
2363
field->charset()->csname);
2369
2369
sql_print_error(_("Incorrect definition of table %s.%s: "
2370
2370
"expected column '%s' at position %d to have type %s "
2371
2371
" but the column is not found."),
2372
table->s->db.str, table->alias,
2373
2373
table_def->name.str, i, table_def->type.str);
3365
3365
as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1".
3367
3367
As an optimization if there is a covering index, and we have
3368
IGNORE INDEX FOR GROUP/ORDER, and this index is used for the JOIN part,
3369
then we have to ignore the IGNORE INDEX FROM GROUP/ORDER.
3368
IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part,
3369
then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
3372
3372
false no errors found
3952
3952
create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
3953
ORDER *group, bool distinct, bool save_sum_fields,
3953
order_st *group, bool distinct, bool save_sum_fields,
3954
3954
uint64_t select_options, ha_rows rows_limit,
3955
3955
char *table_alias)
4456
4456
keyinfo->rec_per_key=0;
4457
4457
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
4458
4458
keyinfo->name= (char*) "group_key";
4459
ORDER *cur_group= group;
4459
order_st *cur_group= group;
4460
4460
for (; cur_group ; cur_group= cur_group->next, key_part_info++)
4462
4462
Field *field=(*cur_group->item)->get_tmp_table_field();