diff options
author | unknown <hartmut@mysql.com> | 2006-04-07 11:23:55 +0200 |
---|---|---|
committer | unknown <hartmut@mysql.com> | 2006-04-07 11:23:55 +0200 |
commit | 4b05efd0921398f6b59933fa90762fd4843994cc (patch) | |
tree | 53b2a624f9e559d7dcebca903ec3ab83e2ccd93c /sql | |
parent | 7a0e989d6b4d0148f7bfea3bb3281b4e0ff4a34f (diff) | |
parent | 7368ba63c9e288e9d51c9b500f1fa23081aed88c (diff) | |
download | mariadb-git-4b05efd0921398f6b59933fa90762fd4843994cc.tar.gz |
Merge mysql.com:/home/hartmut/projects/mysql/dev/5.0
into mysql.com:/home/hartmut/projects/mysql/dev/5.1
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/information_schema.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/opt_sum.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 5 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 | ||||
-rw-r--r-- | sql/opt_sum.cc | 27 |
3 files changed, 12 insertions, 22 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index f28f8b668e2..bb919bd1f13 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3249,7 +3249,10 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) } if (agg_item_charsets(collation, func_name(), - args, arg_count, MY_COLL_ALLOW_CONV)) + args, + /* skip charset aggregation for order columns */ + arg_count - arg_count_order, + MY_COLL_ALLOW_CONV)) return 1; result.set_charset(collation.collation); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 7ee206a4195..24daa08220c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2168,7 +2168,7 @@ longlong Item_extract::val_int() switch (int_type) { case INTERVAL_YEAR: return ltime.year; case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month; - case INTERVAL_QUARTER: return ltime.month/3 + 1; + case INTERVAL_QUARTER: return (ltime.month+2)/3; case INTERVAL_MONTH: return ltime.month; case INTERVAL_WEEK: { diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index aac47707d1b..d4e7745551a 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -123,8 +123,11 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) If the storage manager of 'tl' gives exact row count, compute the total number of rows. If there are no outer table dependencies, this count may be used as the real count. + Schema tables are filled after this function is invoked, so we can't + get row count */ - if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT) + if ((tl->table->file->table_flags() & HA_NOT_EXACT_COUNT) || + tl->schema_table) { is_exact_count= FALSE; count= 1; // ensure count != 0 @@ -149,31 +152,15 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) switch (item_sum->sum_func()) { case Item_sum::COUNT_FUNC: /* - If the expr in count(expr) can never be null we can change this + If the expr in COUNT(expr) can never be null we can change this to the number of rows in the tables if this number is exact and there are no outer joins. */ if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null && !outer_tables && is_exact_count) { - longlong count= 1; - TABLE_LIST *table; - for (table= tables; table; table= table->next_leaf) - { - if (outer_tables || (table->table->file->table_flags() & - HA_NOT_EXACT_COUNT) || table->schema_table) - { - const_result= 0; // Can't optimize left join - break; - } - tables->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); - count*= table->table->file->records; - } - if (!table) - { - ((Item_sum_count*) item)->make_const(count); - recalc_const_item= 1; - } + ((Item_sum_count*) item)->make_const(count); + recalc_const_item= 1; } else const_result= 0; |