mirror of
https://github.com/MariaDB/server.git
synced 2025-07-14 13:41:20 +03:00
MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
set the correct print precedence for IN subqueries
This commit is contained in:
@ -1,7 +1,3 @@
|
|||||||
drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
|
|
||||||
drop view if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
|
|
||||||
drop database if exists mysqltest;
|
|
||||||
use test;
|
|
||||||
SET @save_optimizer_switch=@@optimizer_switch;
|
SET @save_optimizer_switch=@@optimizer_switch;
|
||||||
SET optimizer_switch='outer_join_with_cache=off';
|
SET optimizer_switch='outer_join_with_cache=off';
|
||||||
create view v1 (c,d) as select a,b from t1;
|
create view v1 (c,d) as select a,b from t1;
|
||||||
@ -6325,6 +6321,17 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
|
|||||||
ERROR HY000: Can not modify more than one base table through a join view 'test.v'
|
ERROR HY000: Can not modify more than one base table through a join view 'test.v'
|
||||||
drop view v;
|
drop view v;
|
||||||
drop tables t1,t2,t3;
|
drop tables t1,t2,t3;
|
||||||
|
create table t1 (i int, j int);
|
||||||
|
insert t1 values (1,1),(2,2);
|
||||||
|
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||||
|
select * from v1;
|
||||||
|
(2, 3) not in (select i, j from t1)
|
||||||
|
1
|
||||||
|
show create view v1;
|
||||||
|
View Create View character_set_client collation_connection
|
||||||
|
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)` latin1 latin1_swedish_ci
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
|
|
||||||
--disable_warnings
|
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
|
|
||||||
drop view if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
|
|
||||||
drop database if exists mysqltest;
|
|
||||||
--enable_warnings
|
|
||||||
use test;
|
|
||||||
|
|
||||||
# Save the initial number of concurrent sessions.
|
# Save the initial number of concurrent sessions.
|
||||||
--source include/count_sessions.inc
|
--source include/count_sessions.inc
|
||||||
|
|
||||||
@ -6066,6 +6058,17 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
|
|||||||
drop view v;
|
drop view v;
|
||||||
drop tables t1,t2,t3;
|
drop tables t1,t2,t3;
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
|
||||||
|
#
|
||||||
|
create table t1 (i int, j int);
|
||||||
|
insert t1 values (1,1),(2,2);
|
||||||
|
create view v1 as select (2, 3) not in (select i, j from t1);
|
||||||
|
select * from v1;
|
||||||
|
show create view v1;
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -399,7 +399,7 @@ public:
|
|||||||
bool val_bool();
|
bool val_bool();
|
||||||
bool fix_fields(THD *thd, Item **ref);
|
bool fix_fields(THD *thd, Item **ref);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
void print(String *str, enum_query_type query_type);
|
||||||
bool select_transformer(JOIN *join);
|
bool select_transformer(JOIN *join);
|
||||||
void top_level_item() { abort_on_null=1; }
|
void top_level_item() { abort_on_null=1; }
|
||||||
inline bool is_top_level_item() { return abort_on_null; }
|
inline bool is_top_level_item() { return abort_on_null; }
|
||||||
@ -616,7 +616,8 @@ public:
|
|||||||
void update_null_value () { (void) val_bool(); }
|
void update_null_value () { (void) val_bool(); }
|
||||||
bool val_bool();
|
bool val_bool();
|
||||||
bool test_limit(st_select_lex_unit *unit);
|
bool test_limit(st_select_lex_unit *unit);
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
void print(String *str, enum_query_type query_type);
|
||||||
|
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||||
bool fix_fields(THD *thd, Item **ref);
|
bool fix_fields(THD *thd, Item **ref);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
||||||
@ -740,7 +741,7 @@ public:
|
|||||||
subs_type substype() { return all?ALL_SUBS:ANY_SUBS; }
|
subs_type substype() { return all?ALL_SUBS:ANY_SUBS; }
|
||||||
bool select_transformer(JOIN *join);
|
bool select_transformer(JOIN *join);
|
||||||
void create_comp_func(bool invert) { func= func_creator(invert); }
|
void create_comp_func(bool invert) { func= func_creator(invert); }
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
void print(String *str, enum_query_type query_type);
|
||||||
bool is_maxmin_applicable(JOIN *join);
|
bool is_maxmin_applicable(JOIN *join);
|
||||||
bool transform_into_max_min(JOIN *join);
|
bool transform_into_max_min(JOIN *join);
|
||||||
void no_rows_in_result();
|
void no_rows_in_result();
|
||||||
@ -849,7 +850,7 @@ public:
|
|||||||
uint8 uncacheable();
|
uint8 uncacheable();
|
||||||
void exclude();
|
void exclude();
|
||||||
table_map upper_select_const_tables();
|
table_map upper_select_const_tables();
|
||||||
virtual void print (String *str, enum_query_type query_type);
|
void print (String *str, enum_query_type query_type);
|
||||||
bool change_result(Item_subselect *si,
|
bool change_result(Item_subselect *si,
|
||||||
select_result_interceptor *result,
|
select_result_interceptor *result,
|
||||||
bool temp);
|
bool temp);
|
||||||
@ -883,7 +884,7 @@ public:
|
|||||||
uint8 uncacheable();
|
uint8 uncacheable();
|
||||||
void exclude();
|
void exclude();
|
||||||
table_map upper_select_const_tables();
|
table_map upper_select_const_tables();
|
||||||
virtual void print (String *str, enum_query_type query_type);
|
void print (String *str, enum_query_type query_type);
|
||||||
bool change_result(Item_subselect *si,
|
bool change_result(Item_subselect *si,
|
||||||
select_result_interceptor *result,
|
select_result_interceptor *result,
|
||||||
bool temp= FALSE);
|
bool temp= FALSE);
|
||||||
@ -940,7 +941,7 @@ public:
|
|||||||
uint8 uncacheable() { return UNCACHEABLE_DEPENDENT_INJECTED; }
|
uint8 uncacheable() { return UNCACHEABLE_DEPENDENT_INJECTED; }
|
||||||
void exclude();
|
void exclude();
|
||||||
table_map upper_select_const_tables() { return 0; }
|
table_map upper_select_const_tables() { return 0; }
|
||||||
virtual void print (String *str, enum_query_type query_type);
|
void print (String *str, enum_query_type query_type);
|
||||||
bool change_result(Item_subselect *si,
|
bool change_result(Item_subselect *si,
|
||||||
select_result_interceptor *result,
|
select_result_interceptor *result,
|
||||||
bool temp= FALSE);
|
bool temp= FALSE);
|
||||||
@ -998,7 +999,7 @@ public:
|
|||||||
having(having_arg)
|
having(having_arg)
|
||||||
{}
|
{}
|
||||||
int exec();
|
int exec();
|
||||||
virtual void print (String *str, enum_query_type query_type);
|
void print (String *str, enum_query_type query_type);
|
||||||
virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; }
|
virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1073,11 +1074,8 @@ public:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
int prepare(THD *);
|
int prepare(THD *);
|
||||||
int exec();
|
int exec();
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
void print(String *str, enum_query_type query_type);
|
||||||
uint cols()
|
uint cols() { return materialize_engine->cols(); }
|
||||||
{
|
|
||||||
return materialize_engine->cols();
|
|
||||||
}
|
|
||||||
uint8 uncacheable() { return materialize_engine->uncacheable(); }
|
uint8 uncacheable() { return materialize_engine->uncacheable(); }
|
||||||
table_map upper_select_const_tables() { return 0; }
|
table_map upper_select_const_tables() { return 0; }
|
||||||
bool no_rows() { return !tmp_table->file->stats.records; }
|
bool no_rows() { return !tmp_table->file->stats.records; }
|
||||||
|
Reference in New Issue
Block a user