diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-10-30 19:54:38 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-10-30 19:54:38 +0200 |
commit | 5789f96c624d00aeef137602ab0c4828620748e8 (patch) | |
tree | f0b23110937a12798541e03664fb9dbbea8186f1 | |
parent | 310584a849ea5912c23f3260ce0f2eff3128c566 (diff) | |
download | mariadb-git-5789f96c624d00aeef137602ab0c4828620748e8.tar.gz |
fix LIKE in a vcol function, broken by a fix for mysql bug#54568.
don't set view_prepare_mode when opening a base table
(either in SHOW CREATE or in I_S.TABLES)
4 files changed, 10 insertions, 5 deletions
diff --git a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc index daf59c38a7e..4f6b960f9d0 100644 --- a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc +++ b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc @@ -407,7 +407,7 @@ let $rows = 1; --source suite/vcol/inc/vcol_supported_sql_funcs.inc --echo # LIKE -let $cols = a varchar(10), b bool as (a like 'H%o'); +let $cols = a varchar(10), b bool as (a like 'H%!o' escape '!'); let $values1 = 'Hello',default; let $values2 = 'MySQL',default; let $rows = 2; diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result index 2bc652a7da2..83f755a2e7f 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result @@ -968,12 +968,12 @@ drop table t1; set sql_warnings = 0; # LIKE set sql_warnings = 1; -create table t1 (a varchar(10), b bool as (a like 'H%o')); +create table t1 (a varchar(10), b bool as (a like 'H%!o' escape '!')); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result index a94e220180c..844aae38af2 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result @@ -968,12 +968,12 @@ drop table t1; set sql_warnings = 0; # LIKE set sql_warnings = 1; -create table t1 (a varchar(10), b bool as (a like 'H%o')); +create table t1 (a varchar(10), b bool as (a like 'H%!o' escape '!')); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); diff --git a/sql/table.cc b/sql/table.cc index 8b0d02407c9..7a2581d5ab8 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2074,6 +2074,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, bool error_reported= FALSE; uchar *record, *bitmaps; Field **field_ptr, **vfield_ptr; + bool save_view_prepare_mode= thd->lex->view_prepare_mode; DBUG_ENTER("open_table_from_share"); DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, share->table_name.str, (long) outparam)); @@ -2081,6 +2082,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, /* Parsing of partitioning information from .frm needs thd->lex set up. */ DBUG_ASSERT(thd->lex->is_lex_started); + thd->lex->view_prepare_mode= FALSE; // not a view + error= 1; bzero((char*) outparam, sizeof(*outparam)); outparam->in_use= thd; @@ -2412,6 +2415,7 @@ partititon_err: HA_HAS_OWN_BINLOGGING); thd->status_var.opened_tables++; + thd->lex->view_prepare_mode= save_view_prepare_mode; DBUG_RETURN (0); err: @@ -2424,6 +2428,7 @@ partititon_err: #endif outparam->file= 0; // For easier error checking outparam->db_stat=0; + thd->lex->view_prepare_mode= save_view_prepare_mode; free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN (error); |