Commit 041ac862 authored by unknown's avatar unknown

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1

into gluh.mysql.r18.ru:/home/gluh/MySQL-BUGS/mysql-4.1.6840
parents 948a2655 738e5e8b
...@@ -63,3 +63,12 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET ...@@ -63,3 +63,12 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET
create database d1 default character set latin1 collate latin2_bin; create database d1 default character set latin1 collate latin2_bin;
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1' ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
use mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
show create database mysqltest2;
Database Create Database
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
drop database mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
ERROR 3D000: No database selected
...@@ -86,3 +86,15 @@ create database d1 default character set latin1 collate latin2_bin; ...@@ -86,3 +86,15 @@ create database d1 default character set latin1 collate latin2_bin;
# #
# #
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
#
# Synatx: 'ALTER DATABASE' without db_name
#
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
use mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
show create database mysqltest2;
drop database mysqltest2;
--error 1046
ALTER DATABASE DEFAULT CHARACTER SET latin2;
...@@ -3184,9 +3184,15 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3184,9 +3184,15 @@ purposes internal to the MySQL server", MYF(0));
} }
case SQLCOM_ALTER_DB: case SQLCOM_ALTER_DB:
{ {
if (!strip_sp(lex->name) || check_db_name(lex->name)) char *db= lex->name ? lex->name : thd->db;
if (!db)
{ {
net_printf(thd, ER_WRONG_DB_NAME, lex->name); send_error(thd, ER_NO_DB_ERROR);
goto error;
}
if (!strip_sp(db) || check_db_name(db))
{
net_printf(thd, ER_WRONG_DB_NAME, db);
break; break;
} }
/* /*
...@@ -3198,21 +3204,21 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3198,21 +3204,21 @@ purposes internal to the MySQL server", MYF(0));
*/ */
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
if (thd->slave_thread && if (thd->slave_thread &&
(!db_ok(lex->name, replicate_do_db, replicate_ignore_db) || (!db_ok(db, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(lex->name))) !db_ok_with_wild_table(db)))
{ {
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
break; break;
} }
#endif #endif
if (check_access(thd,ALTER_ACL,lex->name,0,1,0)) if (check_access(thd, ALTER_ACL, db, 0, 1, 0))
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
goto error; goto error;
} }
res=mysql_alter_db(thd,lex->name,&lex->create_info); res= mysql_alter_db(thd, db, &lex->create_info);
break; break;
} }
case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_CREATE_DB:
......
...@@ -609,7 +609,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -609,7 +609,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <simple_string> %type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password remember_name remember_end opt_ident opt_db text_or_password
opt_constraint constraint opt_constraint constraint ident_or_empty
%type <string> %type <string>
text_string opt_gconcat_separator text_string opt_gconcat_separator
...@@ -1870,7 +1870,7 @@ alter: ...@@ -1870,7 +1870,7 @@ alter:
} }
alter_list alter_list
{} {}
| ALTER DATABASE ident | ALTER DATABASE ident_or_empty
{ {
Lex->create_info.default_table_charset= NULL; Lex->create_info.default_table_charset= NULL;
Lex->create_info.used_fields= 0; Lex->create_info.used_fields= 0;
...@@ -1879,10 +1879,15 @@ alter: ...@@ -1879,10 +1879,15 @@ alter:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB; lex->sql_command=SQLCOM_ALTER_DB;
lex->name=$3.str; lex->name= $3;
}; };
ident_or_empty:
/* empty */ { $$= 0; }
| ident { $$= $1.str; };
alter_list: alter_list:
| DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; } | DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; }
| IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; } | IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; }
......
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