Commit 2697582c authored by serg@serg.mysql.com's avatar serg@serg.mysql.com

merged

parents 0ce6e3ea d8849293
This diff is collapsed.
......@@ -8707,7 +8707,7 @@ cat /proc/sys/fs/super-max
@end example
If you have more than 16 MB of memory, you should add something like the
following in your boot script (@file{/etc/rc/boot.local} on SuSE):
following to your init scripts (e.g. @file{/etc/init.d/boot.local} on SuSE Linux):
@example
echo 65536 > /proc/sys/fs/file-max
......@@ -8715,10 +8715,22 @@ echo 8192 > /proc/sys/fs/dquot-max
echo 1024 > /proc/sys/fs/super-max
@end example
You can also run the preceding commands from the command-line as root, but in this case
your old limits will be used the next time your computer reboots.
You can also run the preceding commands from the command-line as root, but
these settings will be lost the next time your computer reboots.
You should also add /etc/my.cnf:
Alternatively, you can set these parameters on bootup by using the
@code{sysctl} tool, which is used by many Linux distributions (SuSE has
added it as well, beginning with SuSE Linux 8.0). Just put the following
values into a file named @file{/etc/sysctl.conf}:
@example
# Increase some values for MySQL
fs.file-max = 65536
fs.dquot-max = 8192
fs.super-max = 1024
@end example
You should also add the following to @file{/etc/my.cnf}:
@example
[safe_mysqld]
......@@ -36937,7 +36949,7 @@ Lock one table at a time until the thread gets all locks.
This policy ensures that table locking is deadlock free. There is
however other things one needs to be aware of with this schema:
If you are using a @code{LOW_PRIORITY_WRITE} lock for a table, this
If you are using a @code{LOW_PRIORITY WRITE} lock for a table, this
means only that MySQL will wait for this particlar lock until
there is no threads that wants a @code{READ} lock. When the thread has
got the @code{WRITE} lock and is waiting to get the lock for the next
......@@ -50367,6 +50379,16 @@ each individual 4.0.x release.
Fixed a bug that caused @code{REPAIR TABLE} to fail on tables
with duplicates in a unique key.
@item
Fixed a bug in guessing a field type out of the function. The error was
introduced in 4.0.3 so that field type depended on the first argument to
the function instead of the function itself
@item
Fixed a bug with wildcarded fields in select list, which led to the wrong
number of elements in a list containing all fields
@item
Fixed bug with the @code{--slow-log} when logging an administrator command
(like @code{FLUSH TABLES}).
@item
Fixed a bug that @code{OPTIMIZE} of locked and modified table,
reported table corruption.
@item
......@@ -50375,6 +50397,12 @@ Fixed a bug in my_getopt in handling of special prefixes (--skip-, --enable-).
similar options.
@item
Fixed bug in checking for output file name of the @code{tee} option.
@item
Added some more optimisation to use index for
@code{SELECT ... FROM many_tables .. ORDER BY key limit #}
@item
Fixed problem in @code{SHOW OPEN TABLES} when a user didn't have access right
to one of the opened tables.
@end itemize
@node News-4.0.3, News-4.0.2, News-4.0.4, News-4.0.x
......@@ -51075,6 +51103,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
Changed @code{AND/OR} to report that they can return NULL. This fixes a
small problem in @code{GROUP BY} on @code{AND/OR} expression that return
@code{NULL}.
@item
Fixed a bug that @code{OPTIMIZE} of locked and modified MyISAM table,
reported table corruption.
@item
......@@ -1857,7 +1857,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1])))
end--;
end[0]= 0;
if (!strlen(file_name))
if (end == file_name)
{
printf("No outfile specified!\n");
return 0;
......
......@@ -1351,13 +1351,12 @@ mysql_init(MYSQL *mysql)
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
return 0;
mysql->free_me=1;
mysql->net.vio = 0;
}
else
bzero((char*) (mysql),sizeof(*(mysql)));
mysql->options.connect_timeout=CONNECT_TIMEOUT;
mysql->last_used_con = mysql->next_slave = mysql->master = mysql;
mysql->last_used_slave = 0;
/*
By default, we are a replication pivot. The caller must reset it
after we return if this is not the case.
......
......@@ -186,7 +186,7 @@ static struct my_option my_long_options[] =
(gptr*) &check_param.max_data_file_length,
0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extend-check", 'e',
"Try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option if you are not totally desperate.",
"If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fast", 'F',
"Check only tables that haven't been closed properly.",
......
drop table if exists t1;
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
insert into t1 values(1, 't1',4,9);
insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
select * from t1;
objid tablename oid test
1 t1 4 9
2 metatable 1 9
3 metaindex 1 9
alter table t1 drop column test;
select * from t1;
objid tablename oid
1 t1 4
2 metatable 1
3 metaindex 1
drop table t1;
......@@ -136,3 +136,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;
......@@ -92,7 +92,8 @@ NULL NULL NULL
0 0
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
grp count(*)
0 7
NULL 1
0 6
1 6
SELECT DISTINCT FACILITY FROM t1;
FACILITY
......@@ -379,3 +380,11 @@ test2@testdomain.com Z001
test2@testdomain.com R002
test3@testdomain.com Z001
drop table t1,t2;
CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate
128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1
DROP TABLE IF EXISTS t1,t2;
......@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
You have an error in your SQL syntax near '' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;
......@@ -134,6 +134,6 @@ handler t2 read next;
a b
19 fff
handler t2 read last;
You have an error in your SQL syntax near '' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
drop table if exists t1;
......@@ -1718,7 +1718,7 @@ insert into tmp select * from t3;
insert into t3 select * from tmp;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
......@@ -1731,7 +1731,7 @@ ammonium ammonium
analyzable analyzable
animals animals
animized animized
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
......@@ -1768,7 +1768,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
......@@ -1781,7 +1781,7 @@ attendants 1
bedlam 1
bedpost 1
boasted 1
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
......@@ -1809,6 +1809,18 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
table type possible_keys key key_len ref rows Extra
t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
t3 ref period period 4 t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
table type possible_keys key key_len ref rows Extra
t3 index period period 4 NULL 41810
t1 ref period period 4 t3.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
table type possible_keys key key_len ref rows Extra
t1 index period period 4 NULL 41810
t3 ref period period 4 t1.period 4181
select period from t1;
period
9410
......
......@@ -16,7 +16,7 @@ table type possible_keys key key_len ref rows Extra
t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
You have an error in your SQL syntax near 'x'hello'' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
select 0xfg;
Unknown column '0xfg' in 'field list'
create table t1 select 1 as x, 2 as xx;
......
-- source include/have_bdb.inc
#
# Small basic test for ALTER TABLE bug ..
# Test of problem when shutting down mysqld at once after ALTER TABLE
#
-- source include/have_bdb.inc
drop table if exists t1;
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
insert into t1 values(1, 't1',4,9);
......@@ -10,3 +9,5 @@ insert into t1 values(2, 'metatable',1,9);
insert into t1 values(3, 'metaindex',1,9 );
select * from t1;
alter table t1 drop column test;
# Now we do a reboot and continue with the next test
#
# Note that this test uses tables from the previous test
# This is to test that the table t1 survives a reboot of MySQL
# The options in the -master.opt file are just there to force the reboot
#
-- source include/have_bdb.inc
select * from t1;
drop table t1;
\ No newline at end of file
drop table t1;
......@@ -91,3 +91,6 @@ show create table t1;
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
drop table if exists t1;
......@@ -242,3 +242,9 @@ SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
drop table t1,t2;
CREATE TABLE t1 ( privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) TYPE=MyISAM;
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
CREATE TABLE t2 ( userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM;
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
DROP TABLE IF EXISTS t1,t2;
......@@ -1405,9 +1405,9 @@ drop table tmp;
# big table done
SET OPTION SQL_BIG_TABLES=1;
SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;
......@@ -1416,9 +1416,9 @@ select distinct fld5 from t2 limit 10;
#
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET OPTION SQL_BIG_TABLES=1; # Force use of MyISAM
SET SQL_BIG_TABLES=1; # Force use of MyISAM
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET OPTION SQL_BIG_TABLES=0;
SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
#
......@@ -1439,6 +1439,14 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
#
# Some test with ORDER BY and limit
#
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
#
# Search with a constant table.
#
......
......@@ -1120,6 +1120,8 @@ Item_cond::fix_fields(THD *thd,TABLE_LIST *tables)
used_tables_cache|=item->used_tables();
with_sum_func= with_sum_func || item->with_sum_func;
const_item_cache&=item->const_item();
if (item->maybe_null)
maybe_null=1;
}
if (thd)
thd->cond_count+=list.elements;
......
......@@ -173,7 +173,7 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
if (!t_arg)
return result_field;
switch (args[0]->result_type()) {
switch (result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,
......
......@@ -524,6 +524,7 @@ bool rm_temporary_table(enum db_type base, char *path);
bool send_fields(THD *thd,List<Item> &item,uint send_field_count);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_thread_tables(THD *thd,bool locked=0);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_temporary_tables(THD *thd);
......
......@@ -377,11 +377,10 @@ char mysql_real_data_home[FN_REFLEN],
blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
*opt_init_file;
char *language_ptr= language;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
#ifndef EMBEDDED_LIBRARY
char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff;
bool mysql_embedded=0;
#else
char *mysql_data_home=mysql_real_data_home;
bool mysql_embedded=1;
#endif
......@@ -1959,6 +1958,7 @@ int main(int argc, char **argv)
{
unireg_abort(1); /* purecov: inspected */
}
mysql_data_home= mysql_data_home_buff;
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home[1]=0;
server_init();
......
......@@ -150,7 +150,7 @@
"Table '%-.64s.%-.64s' doesn't exist",
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'",
"The used command is not allowed with this MySQL version",
"You have an error in your SQL syntax",
"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",
"Delayed insert thread couldn't get requested lock for table %-.64s",
"Too many delayed threads in use",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)",
......
......@@ -157,7 +157,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
table_list.db= (char*) entry->table_cache_key;
table_list.real_name= entry->real_name;
table_list.grant.privilege=0;
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list))
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
continue;
/* need to check if we haven't already listed it */
......@@ -1777,9 +1777,12 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name[0] == '*')
{
uint elem=fields.elements;
if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name,&it))
DBUG_RETURN(-1); /* purecov: inspected */
if (sum_func_list)
sum_func_list->elements += fields.elements - elem;
}
else
{
......
......@@ -356,6 +356,18 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
}
#ifdef SIGNAL_WITH_VIO_CLOSE
void THD::close_active_vio()
{
safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
}
#endif
/*****************************************************************************
** Functions to provide a interface to select results
*****************************************************************************/
......
......@@ -475,15 +475,6 @@ class THD :public ilink {
active_vio = 0;
pthread_mutex_unlock(&LOCK_delete);
}
inline void close_active_vio()
{
safe_mutex_assert_owner(&LOCK_delete);
if (active_vio)
{
vio_close(active_vio);
active_vio = 0;
}
}
#endif
void awake(bool prepare_to_die);
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex,
......
......@@ -620,8 +620,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
(join.const_tables == join.tables ||
(simple_order &&
test_if_skip_sort_order(&join.join_tab[join.const_tables], order,
(join.const_tables != join.tables - 1 ||
(join.select_options & OPTION_FOUND_ROWS)) ?
(join.select_options & OPTION_FOUND_ROWS) ?
HA_POS_ERROR : thd->select_limit,0))))
order=0;
select_describe(&join,need_tmp,
......@@ -640,8 +639,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
DBUG_PRINT("info",("Creating tmp table"));
thd->proc_info="Creating tmp table";
join.tmp_table_param.hidden_field_count=(all_fields.elements-
fields.elements);
join.tmp_table_param.hidden_field_count= all_fields.elements- fields.elements;
if (!(tmp_table =
create_tmp_table(thd,&join.tmp_table_param,all_fields,
((!simple_group && !procedure &&
......@@ -876,7 +874,6 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if (create_sort_index(&join.join_tab[join.const_tables],
group ? group : order,
(having || group ||
join.const_tables != join.tables - 1 ||
(join.select_options & OPTION_FOUND_ROWS)) ?
HA_POS_ERROR : thd->select_limit))
goto err; /* purecov: inspected */
......@@ -2018,7 +2015,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
join->positions[idx].key=best_key;
join->positions[idx].table= s;
if (!best_key && idx == join->const_tables &&
s->table == join->sort_by_table)
s->table == join->sort_by_table &&
join->thd->select_limit >= records)
join->sort_by_table= (TABLE*) 1; // Must use temporary table
/*
......
......@@ -19,6 +19,9 @@
#include "mysql_priv.h"
#include <hash.h>
#ifdef HAVE_BERKELEY_DB
#include <ha_berkeley.h>
#endif
#include <myisam.h>
#include <assert.h>
......@@ -258,10 +261,32 @@ static int sort_keys(KEY *a, KEY *b)
}
/*****************************************************************************
* Create a table.
* If one creates a temporary table, this is automaticly opened
****************************************************************************/
/*
Create a table
SYNOPSIS
mysql_create_table()
thd Thread object
db Database
table_name Table name
create_info Create information (like MAX_ROWS)
fields List of fields to create
keys List of keys to create
tmp_table Set to 1 if this is a temporary table
no_log Don't log the query to binary log.
DESCRIPTION
If one creates a temporary table, this is automaticly opened
no_log is needed for the case of CREATE ... SELECT,
as the logging will be done later in sql_insert.cc
select_field_count is also used for CREATE ... SELECT,
and must be zero for standard create of table.
RETURN VALUES
0 ok
-1 error
*/
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
......@@ -1885,9 +1910,16 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef HAVE_BERKELEY_DB
if (old_db_type == DB_TYPE_BERKELEY_DB)
{
extern bool berkeley_flush_logs(void);
(void)berkeley_flush_logs();
table=open_ltable(thd,table_list,TL_READ);
(void) berkeley_flush_logs();
/*
For the alter table to be properly flushed to the logs, we
have to open the new table. If not, we get a problem on server
shutdown.
*/
if (!open_tables(thd, table_list)) // Should always succeed
{
close_thread_table(thd, &table_list->table);
}
}
#endif
table_list->table=0; // For query cache
......
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