Commit 5789f96c authored by Sergei Golubchik's avatar Sergei Golubchik

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)
parent 310584a8
...@@ -407,7 +407,7 @@ let $rows = 1; ...@@ -407,7 +407,7 @@ let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc --source suite/vcol/inc/vcol_supported_sql_funcs.inc
--echo # LIKE --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 $values1 = 'Hello',default;
let $values2 = 'MySQL',default; let $values2 = 'MySQL',default;
let $rows = 2; let $rows = 2;
......
...@@ -968,12 +968,12 @@ drop table t1; ...@@ -968,12 +968,12 @@ drop table t1;
set sql_warnings = 0; set sql_warnings = 0;
# LIKE # LIKE
set sql_warnings = 1; 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; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(10) DEFAULT NULL, `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 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
insert into t1 values ('Hello',default); insert into t1 values ('Hello',default);
insert into t1 values ('MySQL',default); insert into t1 values ('MySQL',default);
......
...@@ -968,12 +968,12 @@ drop table t1; ...@@ -968,12 +968,12 @@ drop table t1;
set sql_warnings = 0; set sql_warnings = 0;
# LIKE # LIKE
set sql_warnings = 1; 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; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(10) DEFAULT NULL, `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 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('Hello',default); insert into t1 values ('Hello',default);
insert into t1 values ('MySQL',default); insert into t1 values ('MySQL',default);
......
...@@ -2074,6 +2074,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -2074,6 +2074,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
bool error_reported= FALSE; bool error_reported= FALSE;
uchar *record, *bitmaps; uchar *record, *bitmaps;
Field **field_ptr, **vfield_ptr; Field **field_ptr, **vfield_ptr;
bool save_view_prepare_mode= thd->lex->view_prepare_mode;
DBUG_ENTER("open_table_from_share"); DBUG_ENTER("open_table_from_share");
DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str,
share->table_name.str, (long) outparam)); share->table_name.str, (long) outparam));
...@@ -2081,6 +2082,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -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. */ /* Parsing of partitioning information from .frm needs thd->lex set up. */
DBUG_ASSERT(thd->lex->is_lex_started); DBUG_ASSERT(thd->lex->is_lex_started);
thd->lex->view_prepare_mode= FALSE; // not a view
error= 1; error= 1;
bzero((char*) outparam, sizeof(*outparam)); bzero((char*) outparam, sizeof(*outparam));
outparam->in_use= thd; outparam->in_use= thd;
...@@ -2412,6 +2415,7 @@ partititon_err: ...@@ -2412,6 +2415,7 @@ partititon_err:
HA_HAS_OWN_BINLOGGING); HA_HAS_OWN_BINLOGGING);
thd->status_var.opened_tables++; thd->status_var.opened_tables++;
thd->lex->view_prepare_mode= save_view_prepare_mode;
DBUG_RETURN (0); DBUG_RETURN (0);
err: err:
...@@ -2424,6 +2428,7 @@ partititon_err: ...@@ -2424,6 +2428,7 @@ partititon_err:
#endif #endif
outparam->file= 0; // For easier error checking outparam->file= 0; // For easier error checking
outparam->db_stat=0; 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 free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root
my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN (error); DBUG_RETURN (error);
......
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