Details
-
Bug
-
Status: Stalled (View Workflow)
-
Critical
-
Resolution: Unresolved
-
12.1(EOL), 12.2(EOL), 12.3, 13.0, 13.1, 13.3, 13.3.1
-
None
-
Can result in unexpected behaviour
-
Q4/2026 Server Maintenance
Description
This MDEV is waiting for the patch to get merged into 13.1, so 13.1 tests with package wide TYPEs can be added.
MEDIUMTEXT gets truncated to TEXT in assoc array RECORD field
The problem is repeatable starting from 12.1, where associated arrays where introduced.
SET sql_mode=ORACLE; |
DELIMITER $$
|
DECLARE
|
TYPE rec_t IS RECORD (s MEDIUMTEXT); |
TYPE tab_t IS TABLE OF rec_t INDEX BY INTEGER; |
t tab_t;
|
r rec_t;
|
BEGIN
|
r.s:= RPAD('s', 1000, 's'); |
SELECT LENGTH(r.s); |
CREATE OR REPLACE TABLE t1 AS SELECT r.s AS s; |
SHOW CREATE TABLE t1; |
DROP TABLE t1; |
END; |
$$
|
DELIMITER ;
|
+-------------+
|
| LENGTH(r.s) |
|
+-------------+
|
| 255 |
|
+-------------+
|
1 row in set (0.001 sec)
|
 |
+-------+---------------------------------------------------+
|
| Table | Create Table |
|
+-------+---------------------------------------------------+
|
| t1 | CREATE TABLE "t1" (
|
"s" tinytext DEFAULT NULL
|
) |
|
+-------+---------------------------------------------------+
|
1 row in set (0.070 sec)
|
 |
Query OK, 1 row affected (0.109 sec)
|
Notice the length was truncated to 255 bytes and the data type was changed from MEDIUMTEXT to TEXT.
The same problem is repeatable with 13.1 with a package-wide data type:
SET sql_mode=ORACLE; |
DELIMITER $$
|
CREATE OR REPLACE PACKAGE pk0 AS |
TYPE rec_t IS RECORD (s MEDIUMTEXT); |
TYPE tab_t IS TABLE OF rec_t INDEX BY INTEGER; |
END; |
$$
|
DECLARE
|
t pk0.tab_t;
|
r pk0.rec_t;
|
BEGIN
|
r.s:= RPAD('s', 1000, 's'); |
SELECT LENGTH(r.s); |
CREATE OR REPLACE TABLE t1 AS SELECT r.s AS s; |
SHOW CREATE TABLE t1; |
DROP TABLE t1; |
END; |
$$
|
DELIMITER ;
|
DROP PACKAGE pk0; |
+-------------+
|
| LENGTH(r.s) |
|
+-------------+
|
| 255 |
|
+-------------+
|
1 row in set (0.001 sec)
|
 |
+-------+---------------------------------------------------+
|
| Table | Create Table |
|
+-------+---------------------------------------------------+
|
| t1 | CREATE TABLE "t1" (
|
"s" tinytext DEFAULT NULL
|
) |
|
+-------+---------------------------------------------------+
|
1 row in set (0.061 sec)
|
Attachments
Issue Links
- relates to
-
MDEV-41530 A field of an assoc array element as OUT parameter crashes the server
-
- Closed
-