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
23342bad
Commit
23342bad
authored
Nov 29, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-crash-4.1
parents
b226e15a
042c34d8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
47 additions
and
16 deletions
+47
-16
mysql-test/r/row_test.result
mysql-test/r/row_test.result
+10
-1
mysql-test/t/row_test.test
mysql-test/t/row_test.test
+16
-1
sql/item.cc
sql/item.cc
+4
-4
sql/item.h
sql/item.h
+1
-0
sql/item_row.cc
sql/item_row.cc
+1
-1
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+5
-3
sql/sql_handler.cc
sql/sql_handler.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+5
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
mysql-test/r/row_test.result
View file @
23342bad
...
...
@@ -35,7 +35,7 @@ SELECT ('test',2,3.33)=('test',2,3.33);
('test',2,3.33)=('test',2,3.33)
1
SELECT ('test',2,3.33)=('test',2,3.33,4);
Cardinality error (more/less than
4
columns)
Cardinality error (more/less than
3
columns)
drop table if exists t1;
create table t1 ( a int, b int, c int);
insert into t1 values (1,2,3), (2,3,1), (3,2,1);
...
...
@@ -49,3 +49,12 @@ a b c
2 3 1
3 2 1
drop table t1;
select (1,1);
Cardinality error (more/less than 1 columns)
drop table if exists t1;
create table t1 (i int);
select 1 from t1 where (1,1);
Cardinality error (more/less than 1 columns)
select count(*) from t1 order by (1,1);
Cardinality error (more/less than 1 columns)
drop table t1;
mysql-test/t/row_test.test
View file @
23342bad
...
...
@@ -18,4 +18,19 @@ insert into t1 values (1,2,3), (2,3,1), (3,2,1);
select
*
from
t1
where
(
1
,
2
,
3
)
=
(
a
,
b
,
c
);
select
*
from
t1
where
(
0
,
2
,
3
)
=
(
a
,
b
,
c
);
select
*
from
t1
where
(
1
,
2
,
3
)
<
(
a
,
b
,
c
);
drop
table
t1
;
\ No newline at end of file
drop
table
t1
;
--
error
1239
select
(
1
,
1
);
drop
table
if
exists
t1
;
create
table
t1
(
i
int
);
--
error
1239
select
1
from
t1
where
(
1
,
1
);
--
error
1239
select
count
(
*
)
from
t1
order
by
(
1
,
1
);
#TODO remove comments after parser fixing
#-- error 1239
#select count(*) from t1 order by i having (1,1);
#-- error 1239
#select 1 from t1 limit (1,1), (1,1);
drop
table
t1
;
sql/item.cc
View file @
23342bad
...
...
@@ -63,7 +63,7 @@ bool Item::check_cols(uint c)
{
if
(
c
!=
1
)
{
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
1
);
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
c
);
return
1
;
}
return
0
;
...
...
@@ -570,8 +570,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
(
!
r
)
return
1
;
int
res
;
if
(
(
res
=
r
->
fix_fields
(
thd
,
tables
,
ref
)
))
return
res
;
if
(
r
->
check_cols
(
1
)
||
r
->
fix_fields
(
thd
,
tables
,
ref
))
return
1
;
r
->
depended_from
=
last
;
thd
->
lex
.
current_select
->
mark_as_dependent
(
last
);
thd
->
add_possible_loop
(
r
);
...
...
@@ -606,7 +606,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(
char
*
)
field_name
);
if
(
!*
ref
)
return
1
;
return
(
*
ref
)
->
fix_fields
(
thd
,
tables
,
ref
);
return
(
*
ref
)
->
check_cols
(
1
)
||
(
*
ref
)
->
fix_fields
(
thd
,
tables
,
ref
);
}
fixed
=
1
;
return
0
;
...
...
sql/item.h
View file @
23342bad
...
...
@@ -120,6 +120,7 @@ class Item_wrapper :public Item
longlong
val_int
()
{
return
item
->
val_int
();
}
String
*
val_str
(
String
*
s
)
{
return
item
->
val_str
(
s
);
}
void
make_field
(
Send_field
*
f
)
{
item
->
make_field
(
f
);
}
bool
check_cols
(
uint
col
)
{
return
item
->
check_cols
(
col
);
}
};
...
...
sql/item_row.cc
View file @
23342bad
...
...
@@ -59,7 +59,7 @@ bool Item_row::check_cols(uint c)
{
if
(
c
!=
arg_count
)
{
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
arg_count
);
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
c
);
return
1
;
}
return
0
;
...
...
sql/set_var.cc
View file @
23342bad
...
...
@@ -1344,7 +1344,7 @@ int set_var::check(THD *thd)
return
0
;
}
if
(
value
->
fix_fields
(
thd
,
0
,
&
value
))
if
(
value
->
check_cols
(
1
)
||
value
->
fix_fields
(
thd
,
0
,
&
value
))
return
-
1
;
if
(
var
->
check_update_type
(
value
->
result_type
()))
{
...
...
sql/sql_base.cc
View file @
23342bad
...
...
@@ -2101,7 +2101,8 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
}
else
{
if
(
item
->
fix_fields
(
thd
,
tables
,
it
.
ref
()))
if
(
item
->
check_cols
(
1
)
||
item
->
fix_fields
(
thd
,
tables
,
it
.
ref
()))
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
&&
...
...
@@ -2255,7 +2256,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
if
(
*
conds
)
{
thd
->
where
=
"where clause"
;
if
((
*
conds
)
->
fix_fields
(
thd
,
tables
,
conds
))
if
((
*
conds
)
->
check_cols
(
1
)
||
(
*
conds
)
->
fix_fields
(
thd
,
tables
,
conds
))
DBUG_RETURN
(
1
);
}
...
...
@@ -2266,7 +2267,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
->
fix_fields
(
thd
,
tables
,
&
table
->
on_expr
))
if
(
table
->
on_expr
->
check_cols
(
1
)
||
table
->
on_expr
->
fix_fields
(
thd
,
tables
,
&
table
->
on_expr
))
DBUG_RETURN
(
1
);
thd
->
cond_count
++
;
...
...
sql/sql_handler.cc
View file @
23342bad
...
...
@@ -106,7 +106,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
tables
->
table
=
table
;
if
(
cond
&&
cond
->
fix_fields
(
thd
,
tables
,
&
cond
))
if
(
cond
&&
(
cond
->
check_cols
(
1
)
||
cond
->
fix_fields
(
thd
,
tables
,
&
cond
)
))
return
-
1
;
if
(
keyname
)
...
...
sql/sql_prepare.cc
View file @
23342bad
...
...
@@ -501,7 +501,8 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
{
thd
->
where
=
"having clause"
;
thd
->
allow_sum_func
=
1
;
if
(
having
->
fix_fields
(
thd
,
tables
,
&
having
)
||
thd
->
fatal_error
)
if
(
having
->
check_cols
(
1
)
||
having
->
fix_fields
(
thd
,
tables
,
&
having
)
||
thd
->
fatal_error
)
DBUG_RETURN
(
1
);
if
(
having
->
with_sum_func
)
having
->
split_sum_func
(
all_fields
);
...
...
sql/sql_select.cc
View file @
23342bad
...
...
@@ -262,7 +262,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
->
fix_fields
(
thd
,
tables_list
,
&
having
);
bool
having_fix_rc
=
(
having
->
check_cols
(
1
)
||
having
->
fix_fields
(
thd
,
tables_list
,
&
having
));
select_lex
->
having_fix_field
=
0
;
if
(
having_fix_rc
||
thd
->
net
.
report_error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
...
...
@@ -6651,7 +6652,9 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
return
0
;
}
order
->
in_field_list
=
0
;
if
((
*
order
->
item
)
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
thd
->
fatal_error
)
Item
*
it
=
*
order
->
item
;
if
(
it
->
check_cols
(
1
)
||
it
->
fix_fields
(
thd
,
tables
,
order
->
item
)
||
thd
->
fatal_error
)
return
1
;
// Wrong field
all_fields
.
push_front
(
*
order
->
item
);
// Add new field to field list
order
->
item
=
(
Item
**
)
all_fields
.
head_ref
();
...
...
sql/sql_yacc.yy
View file @
23342bad
...
...
@@ -3416,7 +3416,7 @@ kill:
KILL_SYM expr
{
LEX *lex=Lex;
if ($2->fix_fields(lex->thd, 0, &$2))
if ($2->
check_cols(1) || $2->
fix_fields(lex->thd, 0, &$2))
{
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