darold / ora2pg

Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
http://www.ora2pg.com/
GNU General Public License v3.0
1.02k stars 343 forks source link

Special characters and whitespaces in names of functions/procedures #1581

Closed shubham-yb closed 1 year ago

shubham-yb commented 1 year ago

Hi team, If we have some function or procedure in mysql which contains some special characters or whitespaces, the export fails with error.

Example schemas:

drop function if exists `ad@two`;

create function `ad@two`(num1 int,num2 int)
returns int deterministic
return num1+num2;

select `ad@two`(1,2);

Error:

DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@two'
create procedure `a bc`(p_id int)
deterministic
begin
    drop table if exists temp;
    create temporary table temp(id int, name text,key(id));
    insert into temp(id,name) select id,p_name from bar where p_id=id;
    select name from temp;

end//

Error:

DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bc'

Thank You for your help.

mkgrgis commented 1 year ago

See also https://github.com/darold/ora2pg/pull/1563 and https://github.com/darold/ora2pg/issues/1567

darold commented 1 year ago

Commit b99a970 might solve this issue.