[MDEV-13194] ROW data type parse handling broken Created: 2017-06-27  Updated: 2017-07-15  Resolved: 2017-07-15

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 10.3.0
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: M Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

win10 x64, Heidisql 9.4.0.5125



 Description   

When testing out the row data type example supplied in the doc (and MDEV-10142):

CREATE PROCEDURE p1()
BEGIN
  DECLARE r ROW (c1 INT, c2 VARCHAR(10));
  SET r.c1= 10;
  SET r.c2= 'test';
  -- INSERT INTO t1 VALUES (r.c1, r.c2);
END;

Mariadb 10.3.0 returns an sql 1064 error on the very first line, followed by 4056 errors on the subsequent lines:

CREATE PROCEDURE p1()
BEGIN
  DECLARE r ROW (c1 INT, c2 VARCHAR(10));
/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3 */
SET r.c1= 10;
/* SQL Error (4056): Unknown structured system variable or ROW routine variable 'r' */
SET r.c2= 'test';
/* SQL Error (4056): Unknown structured system variable or ROW routine variable 'r' */



 Comments   
Comment by Alice Sherepa [ 2017-06-28 ]

Mysql client treats the first semicolon as the end of the statement. You need to specify a delimiter.
The query below works fine in 10.3.0:

DELIMITER $$
 
CREATE PROCEDURE p1()
BEGIN
  DECLARE a ROW (c1 INT, c2 VARCHAR(10));
  SET a.c1= 10;
  SET a.c2= 'test';
  INSERT INTO t1 VALUES (a.c1, a.c2);
END;
$$
 
DELIMITER ;
CALL p1();

Generated at Thu Feb 08 08:03:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.