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
978 stars 341 forks source link

When migrating from MySQL 5.5/5.6 to PostgreSQL, an exception occurs when the column type is ENUM. #1653

Closed Code-UV closed 10 months ago

Code-UV commented 1 year ago

MySQL Version: 5.5 PostgreSQL Version: 14 ora2pg Version: 3.24.0 MySQL Table: CREATE TABLE Untitled ( test_id bigint(20) , test_set set('1','2') , test_enum enum('1','3') , test_year year(4) , test_bit bit(64), ) Definition exported using ora2pg: CREATE TABLE Untitled ( test_id bigint, test_set text, test_enum,1, test_year smallint, test_bit bit(64), ) Error: The type of the column is enum, but it was converted to 1. The code that triggers this phenomenon is line 415 of MySQL. pm:

If ($row ->[1] eq 'enum'){
$row ->[1]=$row ->[-2];
}

This should be:

If ($row ->[1] eq 'enum'){
$row ->[1]=$row ->[-1];
}
Code-UV commented 1 year ago

When MySQL is 5.5/5.6, $row->[-2] is empty string;When MySQL > 5.7, $row->[-1] is empty string。

darold commented 11 months ago

Commit 49f7889 should fix the issue, please confirm.