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
6e35d0d0
Commit
6e35d0d0
authored
Apr 11, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into olga.mysql.com:/home/igor/mysql-5.0-opt
parents
3478268c
2ccafd29
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
4 deletions
+104
-4
mysql-test/r/row.result
mysql-test/r/row.result
+18
-0
mysql-test/t/row.test
mysql-test/t/row.test
+25
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+61
-4
No files found.
mysql-test/r/row.result
View file @
6e35d0d0
...
...
@@ -175,6 +175,24 @@ ROW(2,10) <=> ROW(3,4)
SELECT ROW(NULL,10) <=> ROW(3,NULL);
ROW(NULL,10) <=> ROW(3,NULL)
0
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
ERROR 21000: Operand should contain 3 column(s)
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
ERROR 21000: Operand should contain 2 column(s)
SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
ERROR 21000: Operand should contain 1 column(s)
SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
1 0 0 0 null
1 0 0 0 NULL
...
...
mysql-test/t/row.test
View file @
6e35d0d0
...
...
@@ -85,6 +85,31 @@ drop table t1;
SELECT
ROW
(
2
,
10
)
<=>
ROW
(
3
,
4
);
SELECT
ROW
(
NULL
,
10
)
<=>
ROW
(
3
,
NULL
);
#
# Bug #27484: nested row expressions in IN predicate
#
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
)),
ROW
(
1
,
1
));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
)),
ROW
(
1
,
1
),
ROW
(
1
,
ROW
(
2
,
3
)));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
)),
ROW
(
1
,
ROW
(
2
,
2
,
2
)));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
,
4
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
,
4
)),
ROW
(
1
,
ROW
(
2
,
2
)));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
)),(
SELECT
1
,
1
));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
(
ROW
(
1
,
ROW
(
2
,
3
)),(
SELECT
1
,
1
),
ROW
(
1
,
ROW
(
2
,
4
)));
--
error
1241
SELECT
ROW
(
1
,
ROW
(
2
,
3
))
IN
((
SELECT
1
,
1
),
ROW
(
1
,
ROW
(
2
,
3
)));
--
error
1241
SELECT
ROW
(
2
,
1
)
IN
(
ROW
(
21
,
2
),
ROW
(
ROW
(
1
,
1
,
3
),
0
));
--
error
1241
SELECT
ROW
(
2
,
1
)
IN
(
ROW
(
ROW
(
1
,
1
,
3
),
0
),
ROW
(
21
,
2
));
# End of 4.1 tests
#
...
...
sql/item_cmpfunc.cc
View file @
6e35d0d0
...
...
@@ -68,6 +68,42 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
}
/*
Compare row signature of two expressions
SYNOPSIS:
cmp_row_type()
item1 the first expression
item2 the second expression
DESCRIPTION
The function checks that two expressions have compatible row signatures
i.e. that the number of columns they return are the same and that if they
are both row expressions then each component from the first expression has
a row signature compatible with the signature of the corresponding component
of the second expression.
RETURN VALUES
1 type incompatibility has been detected
0 otherwise
*/
static
int
cmp_row_type
(
Item
*
item1
,
Item
*
item2
)
{
uint
n
=
item1
->
cols
();
if
(
item2
->
check_cols
(
n
))
return
1
;
for
(
uint
i
=
0
;
i
<
n
;
i
++
)
{
if
(
item2
->
element_index
(
i
)
->
check_cols
(
item1
->
element_index
(
i
)
->
cols
())
||
(
item1
->
element_index
(
i
)
->
result_type
()
==
ROW_RESULT
&&
cmp_row_type
(
item1
->
element_index
(
i
),
item2
->
element_index
(
i
))))
return
1
;
}
return
0
;
}
/*
Aggregates result types from the array of items.
...
...
@@ -82,14 +118,32 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
This function aggregates result types from the array of items. Found type
supposed to be used later for comparison of values of these items.
Aggregation itself is performed by the item_cmp_type() function.
The function also checks compatibility of row signatures for the
submitted items (see the spec for the cmp_row_type function).
RETURN VALUES
1 type incompatibility has been detected
0 otherwise
*/
static
void
agg_cmp_type
(
THD
*
thd
,
Item_result
*
type
,
Item
**
items
,
uint
nitems
)
static
int
agg_cmp_type
(
THD
*
thd
,
Item_result
*
type
,
Item
**
items
,
uint
nitems
)
{
uint
i
;
type
[
0
]
=
items
[
0
]
->
result_type
();
for
(
i
=
1
;
i
<
nitems
;
i
++
)
{
type
[
0
]
=
item_cmp_type
(
type
[
0
],
items
[
i
]
->
result_type
());
/*
When aggregating types of two row expressions we have to check
that they have the same cardinality and that each component
of the first row expression has a compatible row signature with
the signature of the corresponding component of the second row
expression.
*/
if
(
type
[
0
]
==
ROW_RESULT
&&
cmp_row_type
(
items
[
0
],
items
[
i
]))
return
1
;
// error found: invalid usage of rows
}
return
0
;
}
...
...
@@ -1305,7 +1359,8 @@ void Item_func_between::fix_length_and_dec()
*/
if
(
!
args
[
0
]
||
!
args
[
1
]
||
!
args
[
2
])
return
;
agg_cmp_type
(
thd
,
&
cmp_type
,
args
,
3
);
if
(
agg_cmp_type
(
thd
,
&
cmp_type
,
args
,
3
))
return
;
if
(
cmp_type
==
STRING_RESULT
&&
agg_arg_charsets
(
cmp_collation
,
args
,
3
,
MY_COLL_CMP_CONV
,
1
))
return
;
...
...
@@ -2021,7 +2076,8 @@ void Item_func_case::fix_length_and_dec()
for
(
nagg
=
0
;
nagg
<
ncases
/
2
;
nagg
++
)
agg
[
nagg
+
1
]
=
args
[
nagg
*
2
];
nagg
++
;
agg_cmp_type
(
thd
,
&
cmp_type
,
agg
,
nagg
);
if
(
agg_cmp_type
(
thd
,
&
cmp_type
,
agg
,
nagg
))
return
;
if
((
cmp_type
==
STRING_RESULT
)
&&
agg_arg_charsets
(
cmp_collation
,
agg
,
nagg
,
MY_COLL_CMP_CONV
,
1
))
return
;
...
...
@@ -2710,7 +2766,8 @@ void Item_func_in::fix_length_and_dec()
uint
const_itm
=
1
;
THD
*
thd
=
current_thd
;
agg_cmp_type
(
thd
,
&
cmp_type
,
args
,
arg_count
);
if
(
agg_cmp_type
(
thd
,
&
cmp_type
,
args
,
arg_count
))
return
;
if
(
cmp_type
==
STRING_RESULT
&&
agg_arg_charsets
(
cmp_collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
,
1
))
...
...
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