Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
372e2130
Commit
372e2130
authored
Jan 21, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test of cardinality
parent
fc945987
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
40 additions
and
40 deletions
+40
-40
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+2
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+3
-0
sql/item.cc
sql/item.cc
+2
-2
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+7
-9
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-2
sql/item_func.cc
sql/item_func.cc
+4
-4
sql/item_func.h
sql/item_func.h
+1
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-2
sql/item_strfunc.h
sql/item_strfunc.h
+6
-6
sql/item_sum.cc
sql/item_sum.cc
+2
-2
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+4
-5
sql/sql_handler.cc
sql/sql_handler.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+3
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
mysql-test/r/subselect.result
View file @
372e2130
...
...
@@ -120,6 +120,8 @@ SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a');
SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
0
SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
Cardinality error (more/less than 1 columns)
create table t1 (a int);
create table t2 (a int, b int);
create table t3 (a int);
...
...
mysql-test/t/subselect.test
View file @
372e2130
...
...
@@ -51,6 +51,9 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
SELECT
(
SELECT
1.5
,
2
,
'a'
)
=
ROW
(
1.5
,
'c'
,
'a'
);
SELECT
(
SELECT
1.5
,
'c'
,
'a'
)
=
ROW
(
1.5
,
2
,
'a'
);
--
error
1239
SELECT
(
SELECT
*
FROM
(
SELECT
'test'
a
,
'test'
b
)
a
);
create
table
t1
(
a
int
);
create
table
t2
(
a
int
,
b
int
);
create
table
t3
(
a
int
);
...
...
sql/item.cc
View file @
372e2130
...
...
@@ -606,7 +606,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(
char
*
)
field_name
);
if
(
!
r
)
return
1
;
if
(
r
->
check_cols
(
1
)
||
r
->
fix_fields
(
thd
,
tables
,
ref
))
if
(
r
->
fix_fields
(
thd
,
tables
,
ref
)
||
r
->
check_cols
(
1
))
return
1
;
r
->
depended_from
=
last
;
cursel
->
mark_as_dependent
(
last
);
...
...
@@ -630,7 +630,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
(
!
rf
)
return
1
;
(
rf
)
->
outer_resolving
=
outer_resolving
;
return
rf
->
check_cols
(
1
)
||
rf
->
fix_fields
(
thd
,
tables
,
ref
);
return
rf
->
fix_fields
(
thd
,
tables
,
ref
)
||
rf
->
check_cols
(
1
);
}
}
}
...
...
sql/item_cmpfunc.cc
View file @
372e2130
...
...
@@ -913,10 +913,10 @@ double Item_func_case::val()
bool
Item_func_case
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
)
{
if
(
first_expr
&&
(
first_expr
->
check_cols
(
1
)
||
first_expr
->
fix_fields
(
thd
,
tables
,
&
first_expr
))
||
else_expr
&&
(
else_expr
->
check_cols
(
1
)
||
else_expr
->
fix_fields
(
thd
,
tables
,
&
else_expr
)))
if
(
first_expr
&&
(
first_expr
->
fix_fields
(
thd
,
tables
,
&
first_expr
)
||
first_expr
->
check_cols
(
1
))
||
else_expr
&&
(
else_expr
->
fix_fields
(
thd
,
tables
,
&
else_expr
)
||
else_expr
->
check_cols
(
1
)))
return
1
;
if
(
Item_func
::
fix_fields
(
thd
,
tables
,
ref
))
return
1
;
...
...
@@ -1473,7 +1473,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
if
(
abort_on_null
)
item
->
top_level_item
();
if
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tables
,
li
.
ref
()
))
if
(
item
->
fix_fields
(
thd
,
tables
,
li
.
ref
())
||
item
->
check_cols
(
1
))
return
1
;
/* purecov: inspected */
used_tables_cache
|=
item
->
used_tables
();
with_sum_func
=
with_sum_func
||
item
->
with_sum_func
;
...
...
@@ -1785,10 +1785,8 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
bool
Item_func_regex
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
)
{
if
(
args
[
0
]
->
check_cols
(
1
)
||
args
[
1
]
->
check_cols
(
1
)
||
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
1
]
->
fix_fields
(
thd
,
tables
,
args
+
1
))
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
)
||
args
[
1
]
->
fix_fields
(
thd
,
tables
,
args
+
1
)
||
args
[
1
]
->
check_cols
(
1
))
return
1
;
/* purecov: inspected */
with_sum_func
=
args
[
0
]
->
with_sum_func
||
args
[
1
]
->
with_sum_func
;
max_length
=
1
;
...
...
sql/item_cmpfunc.h
View file @
372e2130
...
...
@@ -275,8 +275,7 @@ class Item_func_interval :public Item_int_func
longlong
val_int
();
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
,
Item
**
ref
)
{
return
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
return
(
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
fix_length_and_dec
();
...
...
sql/item_func.cc
View file @
372e2130
...
...
@@ -110,8 +110,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
*/
for
(
arg
=
args
,
arg_end
=
args
+
arg_count
;
arg
!=
arg_end
;
arg
++
)
{
if
((
*
arg
)
->
check_cols
(
allowed_arg_cols
)
||
(
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
))
if
((
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
)
||
(
*
arg
)
->
check_cols
(
allowed_arg_cols
))
return
1
;
/* purecov: inspected */
if
((
*
arg
)
->
maybe_null
)
maybe_null
=
1
;
...
...
@@ -1323,7 +1323,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
arg
!=
arg_end
;
arg
++
,
i
++
)
{
if
((
*
arg
)
->
check_cols
(
1
)
||
(
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
))
if
((
*
arg
)
->
fix_fields
(
thd
,
tables
,
arg
)
||
(
*
arg
)
->
check_cols
(
1
))
return
1
;
if
((
*
arg
)
->
binary
())
func
->
set_charset
(
my_charset_bin
);
...
...
@@ -2331,7 +2331,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
while
((
item
=
li
++
))
{
if
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tlist
,
li
.
ref
()
))
if
(
item
->
fix_fields
(
thd
,
tlist
,
li
.
ref
())
||
item
->
check_cols
(
1
))
return
1
;
if
(
item
->
type
()
==
Item
::
REF_ITEM
)
li
.
replace
(
item
=
*
((
Item_ref
*
)
item
)
->
ref
);
...
...
sql/item_func.h
View file @
372e2130
...
...
@@ -608,8 +608,7 @@ class Item_func_field :public Item_int_func
longlong
val_int
();
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
,
Item
**
ref
)
{
return
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
return
(
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
update_used_tables
()
...
...
sql/item_strfunc.cc
View file @
372e2130
...
...
@@ -2131,7 +2131,7 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables, I
if
(
thd
&&
check_stack_overrun
(
thd
,
buff
))
return
0
;
// Fatal error if flag is set!
if
(
args
[
0
]
->
check_cols
(
1
)
||
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
))
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
))
return
1
;
maybe_null
=
args
[
0
]
->
maybe_null
;
const_item_cache
=
args
[
0
]
->
const_item
();
...
...
@@ -2164,7 +2164,7 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables,
if
(
thd
&&
check_stack_overrun
(
thd
,
buff
))
return
0
;
// Fatal error if flag is set!
if
(
args
[
0
]
->
check_cols
(
1
)
||
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
))
if
(
args
[
0
]
->
fix_fields
(
thd
,
tables
,
args
)
||
args
[
0
]
->
check_cols
(
1
))
return
1
;
maybe_null
=
args
[
0
]
->
maybe_null
;
set_charset
(
set_collation
);
...
...
sql/item_strfunc.h
View file @
372e2130
...
...
@@ -101,8 +101,8 @@ class Item_func_concat_ws :public Item_str_func
void
update_used_tables
();
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tlist
,
Item
**
ref
)
{
return
(
separator
->
check_cols
(
1
)
||
separator
->
fix_fields
(
thd
,
tlist
,
&
separator
)
||
return
(
separator
->
fix_fields
(
thd
,
tlist
,
&
separator
)
||
separator
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
const
char
*
func_name
()
const
{
return
"concat_ws"
;
}
...
...
@@ -382,8 +382,8 @@ class Item_func_elt :public Item_str_func
String
*
val_str
(
String
*
str
);
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tlist
,
Item
**
ref
)
{
return
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
return
(
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
fix_length_and_dec
();
...
...
@@ -415,8 +415,8 @@ class Item_func_make_set :public Item_str_func
String
*
val_str
(
String
*
str
);
bool
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tlist
,
Item
**
ref
)
{
return
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
return
(
item
->
fix_fields
(
thd
,
tlist
,
&
item
)
||
item
->
check_cols
(
1
)
||
Item_func
::
fix_fields
(
thd
,
tlist
,
ref
));
}
void
fix_length_and_dec
();
...
...
sql/item_sum.cc
View file @
372e2130
...
...
@@ -119,7 +119,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
maybe_null
=
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
check_cols
(
1
)
||
args
[
i
]
->
fix_fields
(
thd
,
tables
,
args
+
i
))
if
(
args
[
i
]
->
fix_fields
(
thd
,
tables
,
args
+
i
)
||
args
[
i
]
->
check_cols
(
1
))
return
1
;
if
(
decimals
<
args
[
i
]
->
decimals
)
decimals
=
args
[
i
]
->
decimals
;
...
...
@@ -145,7 +145,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return
1
;
}
thd
->
allow_sum_func
=
0
;
// No included group funcs
if
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tables
,
args
))
if
(
item
->
fix_fields
(
thd
,
tables
,
args
)
||
item
->
check_cols
(
1
))
return
1
;
hybrid_type
=
item
->
result_type
();
if
(
hybrid_type
==
INT_RESULT
)
...
...
sql/set_var.cc
View file @
372e2130
...
...
@@ -1498,7 +1498,7 @@ int set_var::check(THD *thd)
return
0
;
}
if
(
value
->
check_cols
(
1
)
||
value
->
fix_fields
(
thd
,
0
,
&
value
))
if
(
value
->
fix_fields
(
thd
,
0
,
&
value
)
||
value
->
check_cols
(
1
))
return
-
1
;
if
(
var
->
check_update_type
(
value
->
result_type
()))
{
...
...
sql/sql_base.cc
View file @
372e2130
...
...
@@ -1929,8 +1929,7 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
}
else
{
if
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tables
,
it
.
ref
()))
if
(
item
->
fix_fields
(
thd
,
tables
,
it
.
ref
())
||
item
->
check_cols
(
1
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
item
=
*
(
it
.
ref
());
//Item can be chenged in fix fields
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
&&
...
...
@@ -2090,7 +2089,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
if
(
*
conds
)
{
thd
->
where
=
"where clause"
;
if
((
*
conds
)
->
check_cols
(
1
)
||
(
*
conds
)
->
fix_fields
(
thd
,
tables
,
conds
))
if
((
*
conds
)
->
fix_fields
(
thd
,
tables
,
conds
)
||
(
*
conds
)
->
check_cols
(
1
))
DBUG_RETURN
(
1
);
}
...
...
@@ -2101,8 +2100,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
/* Make a join an a expression */
thd
->
where
=
"on clause"
;
if
(
table
->
on_expr
->
check_cols
(
1
)
||
table
->
on_expr
->
fix_fields
(
thd
,
tables
,
&
table
->
on_expr
))
if
(
table
->
on_expr
->
fix_fields
(
thd
,
tables
,
&
table
->
on_expr
)
||
table
->
on_expr
->
check_cols
(
1
))
DBUG_RETURN
(
1
);
thd
->
cond_count
++
;
...
...
sql/sql_handler.cc
View file @
372e2130
...
...
@@ -106,7 +106,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
tables
->
table
=
table
;
if
(
cond
&&
(
cond
->
check_cols
(
1
)
||
cond
->
fix_fields
(
thd
,
tables
,
&
cond
)))
if
(
cond
&&
(
cond
->
fix_fields
(
thd
,
tables
,
&
cond
)
||
cond
->
check_cols
(
1
)))
return
-
1
;
/* InnoDB needs to know that this table handle is used in the HANDLER */
...
...
sql/sql_select.cc
View file @
372e2130
...
...
@@ -271,8 +271,8 @@ JOIN::prepare(TABLE_LIST *tables_init,
thd
->
where
=
"having clause"
;
thd
->
allow_sum_func
=
1
;
select_lex
->
having_fix_field
=
1
;
bool
having_fix_rc
=
(
having
->
check_cols
(
1
)
||
having
->
fix_fields
(
thd
,
tables_list
,
&
having
));
bool
having_fix_rc
=
(
having
->
fix_fields
(
thd
,
tables_list
,
&
having
)
||
having
->
check_cols
(
1
));
select_lex
->
having_fix_field
=
0
;
if
(
having_fix_rc
||
thd
->
net
.
report_error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
...
...
@@ -6912,7 +6912,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
}
order
->
in_field_list
=
0
;
Item
*
it
=
*
order
->
item
;
if
(
it
->
check_cols
(
1
)
||
it
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
if
(
it
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
it
->
check_cols
(
1
)
||
thd
->
fatal_error
)
return
1
;
// Wrong field
all_fields
.
push_front
(
*
order
->
item
);
// Add new field to field list
...
...
sql/sql_yacc.yy
View file @
372e2130
...
...
@@ -3572,7 +3572,7 @@ kill:
KILL_SYM expr
{
LEX *lex=Lex;
if ($2->
check_cols(1) || $2->fix_fields(lex->thd, 0, &$2
))
if ($2->
fix_fields(lex->thd, 0, &$2) || $2->check_cols(1
))
{
send_error(lex->thd, ER_SET_CONSTANTS_ONLY);
YYABORT;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment