yugabyte / yb-voyager

Data migration Engine for YugabyteDB database
36 stars 10 forks source link

[MySQL] Procedures only get exported when written in a particular format #574

Open shubham-yb opened 1 year ago

shubham-yb commented 1 year ago

Jira Link: DB-13485 This was observed while testing the procedures schema object in MYSQL. The procedures were getting exported only when defined in a particular format.

This issue looks similar to one with functions:

https://github.com/yugabyte/yb-voyager/issues/341

Source schema:

drop table if exists view_table1;
​
create table view_table1 (
    id int,
    first_name VARCHAR(50),
    last_name VARCHAR(50),
    email VARCHAR(50),
    gender VARCHAR(50),
    ip_address VARCHAR(20)
);

delimiter //
CREATE PROCEDURE insert_data()
insert into view_table1 (id,first_name, last_name, email, gender, ip_address) values (7,'Milzie', 'Rohlfing', 'mrohlfing5@java.com', 'Female', '230.101.87.42');
//

delimiter ;

The procedure does not get exported.

But the same procedure defined as:

delimiter //
CREATE PROCEDURE insert_data()
BEGIN
insert into view_table1 (id,first_name, last_name, email, gender, ip_address) values (7,'Milzie', 'Rohlfing', 'mrohlfing5@java.com', 'Female', '230.101.87.42');
END
//

delimiter ;

Gets exported.

cc: @priyanshi-yb

shubham-yb commented 1 year ago

Fixed by ora2pg in their commit 8b64f1a543c9e63d3eff80d43b83a74298bfb104 and tested.

shubham-yb commented 1 year ago

This commit brought a regression which causes our automation to fail on a sakila procedure. Thus our current code uses the hash just prior to this.