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
b9c2ae50
Commit
b9c2ae50
authored
Aug 26, 2022
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT
parent
590ce857
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
24 deletions
+67
-24
mysql-test/main/sp-vars.result
mysql-test/main/sp-vars.result
+3
-3
mysql-test/main/sp-vars.test
mysql-test/main/sp-vars.test
+3
-3
mysql-test/main/type_row.result
mysql-test/main/type_row.result
+23
-0
mysql-test/main/type_row.test
mysql-test/main/type_row.test
+28
-0
mysql-test/suite/compat/oracle/r/sp-row.result
mysql-test/suite/compat/oracle/r/sp-row.result
+4
-4
mysql-test/suite/compat/oracle/t/sp-row.test
mysql-test/suite/compat/oracle/t/sp-row.test
+4
-4
sql/field.cc
sql/field.cc
+2
-10
No files found.
mysql-test/main/sp-vars.result
View file @
b9c2ae50
...
...
@@ -1026,11 +1026,11 @@ BEGIN
SELECT arg;
END|
CALL p1((1, 2));
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
CALL p1((SELECT * FROM t1 LIMIT 1));
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
CALL p1((SELECT col1, col2 FROM t1 LIMIT 1));
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'tinyint' in assignment of `arg`
DROP PROCEDURE p1;
DROP TABLE t1;
...
...
mysql-test/main/sp-vars.test
View file @
b9c2ae50
...
...
@@ -1221,13 +1221,13 @@ BEGIN
END
|
delimiter
;
|
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL
p1
((
1
,
2
));
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL
p1
((
SELECT
*
FROM
t1
LIMIT
1
));
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL
p1
((
SELECT
col1
,
col2
FROM
t1
LIMIT
1
));
#
...
...
mysql-test/main/type_row.result
View file @
b9c2ae50
...
...
@@ -49,3 +49,26 @@ ERROR HY000: Illegal parameter data types row and int for operation 'MOD'
#
# End of 10.5 tests
#
#
# Start of 10.7 tests
#
#
# MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT
#
SET sql_mode='';
CREATE TABLE t1 (c1 INT,c2 INT);
CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=(SELECT * FROM t1);
INSERT INTO t1 VALUES (0,0);
ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1`
DROP TABLE t1;
SET sql_mode=DEFAULT;
SET sql_mode='';
CREATE TABLE t1 (c1 INT,c2 INT) ENGINE=MyISAM;
CREATE TRIGGER t BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1=ROW(1,1);
INSERT INTO t1 VALUES (0,0);
ERROR HY000: Cannot cast 'row' as 'int' in assignment of `test`.`t1`.`c1`
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
# End of 10.7 tests
#
mysql-test/main/type_row.test
View file @
b9c2ae50
...
...
@@ -60,3 +60,31 @@ SELECT ROW(1,1) % 1;
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
--
echo
#
--
echo
# Start of 10.7 tests
--
echo
#
--
echo
#
--
echo
# MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT
--
echo
#
SET
sql_mode
=
''
;
CREATE
TABLE
t1
(
c1
INT
,
c2
INT
);
CREATE
TRIGGER
t
BEFORE
INSERT
ON
t1
FOR
EACH
ROW
SET
NEW
.
c1
=
(
SELECT
*
FROM
t1
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT
INTO
t1
VALUES
(
0
,
0
);
DROP
TABLE
t1
;
SET
sql_mode
=
DEFAULT
;
SET
sql_mode
=
''
;
CREATE
TABLE
t1
(
c1
INT
,
c2
INT
)
ENGINE
=
MyISAM
;
CREATE
TRIGGER
t
BEFORE
INSERT
ON
t1
FOR
EACH
ROW
SET
NEW
.
c1
=
ROW
(
1
,
1
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
INSERT
INTO
t1
VALUES
(
0
,
0
);
DROP
TABLE
t1
;
SET
sql_mode
=
DEFAULT
;
--
echo
#
--
echo
# End of 10.7 tests
--
echo
#
mysql-test/suite/compat/oracle/r/sp-row.result
View file @
b9c2ae50
...
...
@@ -24,7 +24,7 @@ RETURN a;
END;
$$
SELECT f1(ROW(10,20));
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'int' in assignment of `f1(ROW(10,20))`
DROP FUNCTION f1;
#
# ROW as an SP parameter
...
...
@@ -261,7 +261,7 @@ SELECT f1(a);
END;
$$
CALL p1();
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'int' in assignment of `a`
DROP PROCEDURE p1;
DROP FUNCTION f1;
CREATE FUNCTION f1(a INT) RETURN INT
...
...
@@ -278,7 +278,7 @@ SELECT f1(a);
END;
$$
CALL p1();
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'int' in assignment of `a`
DROP PROCEDURE p1;
DROP FUNCTION f1;
#
...
...
@@ -332,7 +332,7 @@ RETURN rec;
END;
$$
SELECT f1(10);
ERROR
21000: Operand should contain 1 column(s)
ERROR
HY000: Cannot cast 'row' as 'int' in assignment of `f1(10)`
DROP FUNCTION f1;
#
# Using the entire ROW in SELECT..CREATE
...
...
mysql-test/suite/compat/oracle/t/sp-row.test
View file @
b9c2ae50
...
...
@@ -35,7 +35,7 @@ BEGIN
END
;
$$
DELIMITER
;
$$
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
f1
(
ROW
(
10
,
20
));
DROP
FUNCTION
f1
;
...
...
@@ -334,7 +334,7 @@ BEGIN
END
;
$$
DELIMITER
;
$$
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL
p1
();
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f1
;
...
...
@@ -355,7 +355,7 @@ BEGIN
END
;
$$
DELIMITER
;
$$
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL
p1
();
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f1
;
...
...
@@ -427,7 +427,7 @@ BEGIN
END
;
$$
DELIMITER
;
$$
--
error
ER_
OPERAND_COLUMNS
--
error
ER_
ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
f1
(
10
);
DROP
FUNCTION
f1
;
...
...
sql/field.cc
View file @
b9c2ae50
...
...
@@ -983,7 +983,8 @@ bool Field::check_assignability_from(const Type_handler *from,
type_handler_for_item_field
());
if
(
th
.
aggregate_for_result
(
from
->
type_handler_for_item_field
()))
{
bool
error
=
!
ignore
&&
get_thd
()
->
is_strict_mode
();
bool
error
=
(
!
ignore
&&
get_thd
()
->
is_strict_mode
())
||
(
type_handler
()
->
is_scalar_type
()
!=
from
->
is_scalar_type
());
/*
Display fully qualified column name for table columns.
Display non-qualified names for other things,
...
...
@@ -1474,15 +1475,6 @@ bool Field::sp_prepare_and_store_item(THD *thd, Item **value)
if
(
!
(
expr_item
=
thd
->
sp_fix_func_item_for_assignment
(
this
,
value
)))
goto
error
;
/*
expr_item is now fixed, it's safe to call cmp_type()
*/
if
(
expr_item
->
cmp_type
()
==
ROW_RESULT
)
{
my_error
(
ER_OPERAND_COLUMNS
,
MYF
(
0
),
1
);
goto
error
;
}
/* Save the value in the field. Convert the value if needed. */
expr_item
->
save_in_field
(
this
,
0
);
...
...
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