Commit fe5254b6 authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/50-jonas

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.0


ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
parents 91028ccc ce099dfe
......@@ -719,3 +719,11 @@ lily
river
drop table t1;
deallocate prepare stmt;
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
data_type character_octet_length character_maximum_length
blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
......@@ -626,3 +626,8 @@ latin1
latin1
drop table t1, t2, t3;
set names default;
create table t1 (c1 varchar(10), c2 int);
select charset(group_concat(c1 order by c2)) from t1;
charset(group_concat(c1 order by c2))
latin1
drop table t1;
......@@ -360,6 +360,42 @@ extract(SECOND FROM "1999-01-02 10:11:12")
select extract(MONTH FROM "2001-02-00");
extract(MONTH FROM "2001-02-00")
2
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
quarter
1
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
quarter
2
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
quarter
3
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
quarter
4
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
quarter
4
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
1968-01-20 03:14:08
......
......@@ -1041,14 +1041,6 @@ select 1 from (select 1 from test.t1) a;
1
use test;
drop table t1;
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
data_type character_octet_length character_maximum_length
blob 65535 65535
text 65535 65535
text 65535 32767
drop table t1;
create table t1 (f1 int(11));
create view v1 as select * from t1;
drop table t1;
......
......@@ -4811,6 +4811,17 @@ begin
declare x int;
select id from t1 order by x;
end|
drop procedure if exists bug14945|
create table t3 (id int not null auto_increment primary key)|
create procedure bug14945() deterministic truncate t3|
insert into t3 values (null)|
call bug14945()|
insert into t3 values (null)|
select * from t3|
id
1
drop table t3|
drop procedure bug14945|
create procedure bug16474_2(x int)
select id from t1 order by x|
call bug16474_1()|
......
......@@ -455,3 +455,11 @@ execute stmt using @param1;
select utext from t1 where utext like '%%';
drop table t1;
deallocate prepare stmt;
#
# Bug #14290: character_maximum_length for text fields
#
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
drop table t1;
......@@ -414,3 +414,11 @@ select charset(a) from t2;
select charset(a) from t3;
drop table t1, t2, t3;
set names default;
#
# Bug#18281 group_concat changes charset to binary
#
create table t1 (c1 varchar(10), c2 int);
select charset(group_concat(c1 order by c2)) from t1;
drop table t1;
......@@ -139,6 +139,24 @@ select extract(MINUTE_SECOND FROM "10:11:12");
select extract(SECOND FROM "1999-01-02 10:11:12");
select extract(MONTH FROM "2001-02-00");
#
# test EXTRACT QUARTER (Bug #18100)
#
SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
#
# Test big intervals (Bug #3498)
#
......
......@@ -738,15 +738,6 @@ select 1 from (select 1 from test.t1) a;
use test;
drop table t1;
#
# Bug #14290: character_maximum_length for text fields
#
create table t1(a blob, b text charset utf8, c text charset ucs2);
select data_type, character_octet_length, character_maximum_length
from information_schema.columns where table_name='t1';
drop table t1;
#
# Bug#14476 `information_schema`.`TABLES`.`TABLE_TYPE` with empty value
#
......
......@@ -5666,6 +5666,21 @@ begin
select id from t1 order by x;
end|
#
# BUG#14945: Truncate table doesn't reset the auto_increment counter
#
--disable_warnings
drop procedure if exists bug14945|
--enable_warnings
create table t3 (id int not null auto_increment primary key)|
create procedure bug14945() deterministic truncate t3|
insert into t3 values (null)|
call bug14945()|
insert into t3 values (null)|
select * from t3|
drop table t3|
drop procedure bug14945|
# This does NOT order by column index; variable is an expression.
create procedure bug16474_2(x int)
select id from t1 order by x|
......
......@@ -1109,9 +1109,14 @@ NdbDictInterface::getTable(const BaseString& name, bool fullyQualifiedNames)
// Copy name to m_buffer to get a word sized buffer
m_buffer.clear();
m_buffer.grow(namelen_words*4);
m_buffer.grow(namelen_words*4+4);
m_buffer.append(name.c_str(), namelen);
#ifndef IGNORE_VALGRIND_WARNINGS
Uint32 pad = 0;
m_buffer.append(&pad, 4);
#endif
LinearSectionPtr ptr[1];
ptr[0].p= (Uint32*)m_buffer.get_data();
ptr[0].sz= namelen_words;
......
......@@ -427,19 +427,26 @@ NdbLinHash<C>::getNext(NdbElement_t<C> * curr){
return curr->next;
int dir = 0, seg = 0;
if(curr != 0){
int counts;
if(curr != 0)
{
getBucket(curr->hash, &dir, &seg);
counts = seg + 1;
}
else
{
counts = 0;
}
for(int countd = dir; countd < DIRECTORYSIZE;countd++ ){
if (directory[countd] != 0) {
for(int counts = seg + 1; counts < SEGMENTSIZE; counts++ ){
for(; counts < SEGMENTSIZE; counts++ ){
if (directory[countd]->elements[counts] != 0) {
return directory[countd]->elements[counts];
}
}
}
counts = 0;
}
return 0;
......
......@@ -3226,7 +3226,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);
......
......@@ -2213,7 +2213,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:
{
......
......@@ -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;
......
......@@ -842,8 +842,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
table_list->db, table_list->table_name);
DBUG_RETURN(TRUE);
}
if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)
|| thd->lex->sphead)
if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
goto trunc_by_del;
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(TRUE);
......
......@@ -3350,7 +3350,7 @@ mysql_execute_command(THD *thd)
Don't allow this within a transaction because we want to use
re-generate table
*/
if ((thd->locked_tables && !lex->sphead) || thd->active_transaction())
if (thd->locked_tables || thd->active_transaction())
{
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
......
......@@ -72,6 +72,10 @@ else
libexecdir="$basedir/libexec"
fi
# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=
#
# Use LSB init script functions for printing messages, if possible
#
......@@ -105,11 +109,15 @@ parse_server_arguments() {
case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
bindir="$basedir/bin"
datadir="$basedir/data"
if test -z "$datadir_set"; then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
datadir_set=1
;;
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--use-mysqld_safe) use_mysqld_safe=1;;
......
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