Commit 674d1027 authored by kostja@bodhi.(none)'s avatar kostja@bodhi.(none)

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  bodhi.(none):/opt/local/work/mysql-5.0-runtime
parents 38deea24 2d8decab
......@@ -396,6 +396,8 @@ prepare stmt1 from ' execute stmt2 ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from ' deallocate prepare never_prepared ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt1 from 'alter view v1 as select 2';
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt4 from ' use test ' ;
ERROR HY000: This command is not supported in the prepared statement protocol yet
prepare stmt3 from ' create database mysqltest ';
......@@ -466,7 +468,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 14 N 1 31 8
......@@ -482,7 +484,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 5 Y 0 31 8
def possible_keys 253 4096 7 Y 0 31 8
def key 253 64 7 Y 0 31 8
def key_len 253 4096 1 Y 128 31 63
def key_len 253 1365 1 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 27 N 1 31 8
......
......@@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
......@@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
......@@ -1159,7 +1159,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
......@@ -1201,7 +1201,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......@@ -4222,7 +4222,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
......@@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
......@@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def key_len 253 1365 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
......
This diff is collapsed.
......@@ -87,6 +87,10 @@ prepare stmt from "create table t1 (a int)";
execute stmt;
insert into t1 (a) values (1);
select * from t1;
prepare stmt_alter from "alter table t1 add (b int)";
execute stmt_alter;
insert into t1 (a,b) values (2,1);
deallocate prepare stmt_alter;
deallocate prepare stmt;
deallocate prepare stmt_drop;
end|
......@@ -245,6 +249,9 @@ a
1
drop procedure p1|
drop table if exists t1|
drop table if exists t2|
Warnings:
Note 1051 Unknown table 't2'
create table t1 (id integer primary key auto_increment,
stmt_text char(35), status varchar(20))|
insert into t1 (stmt_text) values
......@@ -255,7 +262,10 @@ insert into t1 (stmt_text) values
("help help"), ("show databases"), ("show tables"),
("show table status"), ("show open tables"), ("show storage engines"),
("insert into t1 (id) values (1)"), ("update t1 set status=''"),
("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")|
("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"),
("create view v1 as select 1"), ("alter view v1 as select 2"),
("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"),
("drop table t2")|
create procedure p1()
begin
declare v_stmt_text varchar(255);
......@@ -305,6 +315,12 @@ id stmt_text status
20 truncate t1 supported
21 call p1() supported
22 foo bar syntax error
23 create view v1 as select 1 supported
24 alter view v1 as select 2 not supported
25 drop view v1 supported
26 create table t2 (a int) supported
27 alter table t2 add (b int) supported
28 drop table t2 supported
drop procedure p1|
drop table t1|
prepare stmt from 'select 1'|
......
......@@ -982,9 +982,9 @@ ERROR HY000: Explicit or implicit commit is not allowed in stored function or tr
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
ERROR 0A000: ALTER VIEW is not allowed in stored procedures
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
ERROR 0A000: ALTER VIEW is not allowed in stored procedures
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END |
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END |
......
......@@ -423,6 +423,10 @@ prepare stmt1 from ' execute stmt2 ' ;
--error ER_UNSUPPORTED_PS
prepare stmt1 from ' deallocate prepare never_prepared ' ;
## We don't support alter view as prepared statements
--error ER_UNSUPPORTED_PS
prepare stmt1 from 'alter view v1 as select 2';
## switch the database connection
--error 1295
prepare stmt4 from ' use test ' ;
......
......@@ -18,6 +18,12 @@ flush privileges;
create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
check table t1 fast;
check table t1 fast;
check table t1 changed;
......@@ -26,28 +32,58 @@ check table t1 changed;
check table t1 medium;
check table t1 extended;
show index from t1;
--disable_metadata
--error 1062
insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
optimize table t1;
--disable_metadata
optimize table t1;
drop table t1;
#show variables;
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
show variables like "wait_timeout%";
show variables like "WAIT_timeout%";
show variables like "this_doesn't_exists%";
show table status from test like "this_doesn't_exists%";
show databases;
show databases like "test%";
--disable_metadata
#
# Check of show index
#
create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1);
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
analyze table t1;
--disable_metadata
show index from t1;
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
repair table t1;
--disable_metadata
show index from t1;
drop table t1;
......@@ -518,4 +554,216 @@ show status like 'slow_queries';
select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
#
# Ensure that all needed objects are dropped.
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
# Create objects.
CREATE DATABASE mysqltest1;
CREATE TABLE t1(c INT NOT NULL PRIMARY KEY);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
CREATE VIEW v1 AS SELECT 1;
CREATE PROCEDURE p1() SELECT 1;
CREATE FUNCTION f1() RETURNS INT RETURN 1;
# Test.
set names utf8;
--echo -- Here we enable metadata just to check that the collation of the
--echo -- resultset is non-binary for string type. This should be changed
--echo -- after Bug#29394 is implemented.
--enable_metadata
--echo ----------------------------------------------------------------
SHOW CHARACTER SET LIKE 'utf8';
--echo ----------------------------------------------------------------
SHOW COLLATION LIKE 'latin1_bin';
--echo ----------------------------------------------------------------
SHOW CREATE DATABASE mysqltest1;
--echo ----------------------------------------------------------------
SHOW DATABASES LIKE 'mysqltest1';
--echo ----------------------------------------------------------------
SHOW CREATE TABLE t1;
--echo ----------------------------------------------------------------
SHOW INDEX FROM t1;
--echo ----------------------------------------------------------------
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME,
TABLE_TYPE,
ENGINE,
ROW_FORMAT,
TABLE_COLLATION,
CREATE_OPTIONS,
TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 't1';
--echo ----------------------------------------------------------------
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
COLUMN_DEFAULT,
IS_NULLABLE,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME,
COLUMN_TYPE,
COLUMN_KEY,
EXTRA,
PRIVILEGES,
COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 't1';
--echo ----------------------------------------------------------------
SHOW TABLES LIKE 't1';
--echo ----------------------------------------------------------------
SHOW COLUMNS FROM t1;
--echo ----------------------------------------------------------------
SHOW TRIGGERS LIKE 't1';
--echo ----------------------------------------------------------------
SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,
EVENT_MANIPULATION,
EVENT_OBJECT_CATALOG,
EVENT_OBJECT_SCHEMA,
EVENT_OBJECT_TABLE,
ACTION_CONDITION,
ACTION_STATEMENT,
ACTION_ORIENTATION,
ACTION_TIMING,
ACTION_REFERENCE_OLD_TABLE,
ACTION_REFERENCE_NEW_TABLE,
ACTION_REFERENCE_OLD_ROW,
ACTION_REFERENCE_NEW_ROW,
SQL_MODE,
DEFINER
FROM INFORMATION_SCHEMA.TRIGGERS
WHERE trigger_name = 't1_bi';
--echo ----------------------------------------------------------------
SHOW CREATE VIEW v1;
--echo ----------------------------------------------------------------
SELECT *
FROM INFORMATION_SCHEMA.VIEWS
WHERE table_name = 'v1';
--echo ----------------------------------------------------------------
SHOW CREATE PROCEDURE p1;
--echo ----------------------------------------------------------------
SELECT
SPECIFIC_NAME,
ROUTINE_CATALOG,
ROUTINE_SCHEMA,
ROUTINE_NAME,
ROUTINE_TYPE,
DTD_IDENTIFIER,
ROUTINE_BODY,
ROUTINE_DEFINITION,
EXTERNAL_NAME,
EXTERNAL_LANGUAGE,
PARAMETER_STYLE,
IS_DETERMINISTIC,
SQL_DATA_ACCESS,
SQL_PATH,
SECURITY_TYPE,
SQL_MODE,
ROUTINE_COMMENT,
DEFINER
FROM INFORMATION_SCHEMA.ROUTINES
WHERE routine_name = 'p1';
--echo ----------------------------------------------------------------
SHOW CREATE FUNCTION f1;
--echo ----------------------------------------------------------------
SELECT
SPECIFIC_NAME,
ROUTINE_CATALOG,
ROUTINE_SCHEMA,
ROUTINE_NAME,
ROUTINE_TYPE,
DTD_IDENTIFIER,
ROUTINE_BODY,
ROUTINE_DEFINITION,
EXTERNAL_NAME,
EXTERNAL_LANGUAGE,
PARAMETER_STYLE,
IS_DETERMINISTIC,
SQL_DATA_ACCESS,
SQL_PATH,
SECURITY_TYPE,
SQL_MODE,
ROUTINE_COMMENT,
DEFINER
FROM INFORMATION_SCHEMA.ROUTINES
WHERE routine_name = 'f1';
--echo ----------------------------------------------------------------
--disable_metadata
# Cleanup.
DROP DATABASE mysqltest1;
DROP TABLE t1;
DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
--echo End of 5.0 tests
......@@ -85,7 +85,7 @@ call p1()|
call p1()|
drop procedure p1|
#
# D. Create/Drop a table (a DDL that issues a commit) in Dynamic SQL.
# D. Create/Drop/Alter a table (a DDL that issues a commit) in Dynamic SQL.
# (should work ok).
#
create procedure p1()
......@@ -96,6 +96,10 @@ begin
execute stmt;
insert into t1 (a) values (1);
select * from t1;
prepare stmt_alter from "alter table t1 add (b int)";
execute stmt_alter;
insert into t1 (a,b) values (2,1);
deallocate prepare stmt_alter;
deallocate prepare stmt;
deallocate prepare stmt_drop;
end|
......@@ -239,6 +243,7 @@ drop procedure p1|
# K. Use of continue handlers with Dynamic SQL.
#
drop table if exists t1|
drop table if exists t2|
create table t1 (id integer primary key auto_increment,
stmt_text char(35), status varchar(20))|
insert into t1 (stmt_text) values
......@@ -249,7 +254,10 @@ insert into t1 (stmt_text) values
("help help"), ("show databases"), ("show tables"),
("show table status"), ("show open tables"), ("show storage engines"),
("insert into t1 (id) values (1)"), ("update t1 set status=''"),
("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")|
("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"),
("create view v1 as select 1"), ("alter view v1 as select 2"),
("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"),
("drop table t2")|
create procedure p1()
begin
declare v_stmt_text varchar(255);
......
......@@ -1087,12 +1087,12 @@ delimiter ;|
#
# BUG 12490 (Packets out of order if calling HELP CONTENTS from Stored Procedure)
#
--error 1314
--error ER_SP_BADSTATEMENT
CREATE PROCEDURE BUG_12490() HELP CONTENTS;
--error 1314
--error ER_SP_BADSTATEMENT
CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS;
CREATE TABLE t_bug_12490(a int);
--error 1314
--error ER_SP_BADSTATEMENT
CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS;
DROP TABLE t_bug_12490;
......@@ -1397,9 +1397,9 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as sele
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-- error ER_SP_BADSTATEMENT
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-- error ER_SP_BADSTATEMENT
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
-- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
......
......@@ -1343,7 +1343,7 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path,
strmake(buff, thd->net.last_error, sizeof(buff)-1);
thd->query_error= 0;
thd->spcont= 0;
thd->spcont= NULL;
thd->lex->current_select= 0;
thd->net.last_error[0]= 0;
......
......@@ -1764,11 +1764,17 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
};
/**
Item_empty_string -- is a utility class to put an item into List<Item>
which is then used in protocol.send_fields() when sending SHOW output to
the client.
*/
class Item_empty_string :public Item_string
{
public:
Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) :
Item_string("",0, cs ? cs : &my_charset_bin)
Item_string("",0, cs ? cs : &my_charset_utf8_general_ci)
{ name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; }
void make_field(Send_field *field);
};
......
......@@ -438,10 +438,10 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
Lex_input_stream lip(thd, defstr.c_ptr(), defstr.length());
thd->m_lip= &lip;
lex_start(thd);
thd->spcont= NULL;
ret= MYSQLparse(thd);
}
thd->spcont= 0;
if (ret || thd->is_fatal_error || newlex.sphead == NULL)
{
sp_head *sp= newlex.sphead;
......
......@@ -2581,7 +2581,7 @@ sp_instr_set::exec_core(THD *thd, uint *nextp)
sp_rcontext *spcont= thd->spcont;
thd->spcont= 0; /* Avoid handlers */
thd->spcont= NULL; /* Avoid handlers */
my_error(ER_OUT_OF_RESOURCES, MYF(0));
spcont->clear_handler();
thd->spcont= spcont;
......@@ -3316,7 +3316,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp)
sp_rcontext *spcont= thd->spcont;
thd->spcont= 0; /* Avoid handlers */
thd->spcont= NULL; /* Avoid handlers */
my_error(ER_OUT_OF_RESOURCES, MYF(0));
spcont->clear_handler();
thd->spcont= spcont;
......
......@@ -697,6 +697,13 @@ public:
#ifndef DBUG_OFF
bool is_backup_arena; /* True if this arena is used for backup. */
#endif
/*
The states relfects three diffrent life cycles for three
different types of statements:
Prepared statement: INITIALIZED -> PREPARED -> EXECUTED.
Stored procedure: INITIALIZED_FOR_SP -> EXECUTED.
Other statements: CONVENTIONAL_EXECUTION never changes.
*/
enum enum_state
{
INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2,
......
......@@ -126,7 +126,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
sp_rcontext *spcont= thd->spcont;
thd->no_warnings_for_error= 1;
thd->spcont= 0;
thd->spcont= NULL;
thd->killed= THD::KILL_BAD_DATA;
my_message(code, msg, MYF(0));
......
......@@ -4893,6 +4893,10 @@ create_sp_error:
#endif // ifndef DBUG_OFF
case SQLCOM_CREATE_VIEW:
{
/*
Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands
as specified through the thd->lex->create_view_mode flag.
*/
if (end_active_trans(thd))
goto error;
......
......@@ -1724,6 +1724,13 @@ static bool check_prepared_statement(Prepared_statement *stmt,
res= mysql_test_create_table(stmt);
break;
case SQLCOM_CREATE_VIEW:
if (lex->create_view_mode == VIEW_ALTER)
{
my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
goto error;
}
break;
case SQLCOM_DO:
res= mysql_test_do_fields(stmt, tables, lex->insert_list);
break;
......@@ -1766,7 +1773,6 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case SQLCOM_ROLLBACK:
case SQLCOM_TRUNCATE:
case SQLCOM_CALL:
case SQLCOM_CREATE_VIEW:
case SQLCOM_DROP_VIEW:
case SQLCOM_REPAIR:
case SQLCOM_ANALYZE:
......
......@@ -982,7 +982,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
Lex_input_stream lip(thd, trg_create_str->str, trg_create_str->length);
thd->m_lip= &lip;
lex_start(thd);
thd->spcont= 0;
thd->spcont= NULL;
int err= MYSQLparse((void *)thd);
if (err || thd->is_fatal_error)
......
......@@ -205,18 +205,17 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
}
/*
Creating/altering VIEW procedure
/**
@brief Creating/altering VIEW procedure
SYNOPSIS
mysql_create_view()
thd - thread handler
views - views to create
mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
@param thd thread handler
@param views views to create
@param mode VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
RETURN VALUE
FALSE OK
TRUE Error
@note This function handles both create and alter view commands.
@retval FALSE Operation was a success.
@retval TRUE An error occured.
*/
bool mysql_create_view(THD *thd, TABLE_LIST *views,
......
......@@ -3671,6 +3671,11 @@ alter:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_CREATE_VIEW;
lex->create_view_mode= VIEW_ALTER;
/* first table in list is target VIEW name */
......
......@@ -7564,7 +7564,9 @@ static void test_explain_bug()
else
{
verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_VAR_STRING, "",
"", "", NAME_LEN*MAX_KEY, 0);
"", "",
NAME_LEN*MAX_KEY / my_charset_utf8_general_ci.mbmaxlen,
0);
}
verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING,
......
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