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;
--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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
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