dalibo/db2topg

[db2inst1@OESdb2pocserver db2topg-master]$ vi /u01/db2inst1/my_db2_sql_script.sql [db2inst1@OESdb2pocserver db2topg-master]$ ./db2topg.pl -f /u01/db2inst1/my_db2_sql_script.sql -o /u01/db2inst1/output_dir/ -d TESTDB -u adminuser -p ***** I don't understand ALTER TABLE "DB2INST1"."EMPLOYEE" ADD CONSTRAINT "PK_EMPLOYEE" PRIMARY KEY ("EMPNO") ENFORCED in an ALTER TABLE section at ./db2topg.pl line 829, <IN> line 202.

vijaysharma212 opened this issue · 2 comments

I tried to use db2topg script to convert Db2 code to Postgres database and getting this kind of error for constraints,ALTER TABLE and CREATE TABLE statements. Please confirm if this script will work for all type of objects type.

[db2inst1@OESdb2pocserver db2topg-master]$ vi /u01/db2inst1/my_db2_sql_script.sql [db2inst1@OESdb2pocserver db2topg-master]$ ./db2topg.pl -f /u01/db2inst1/my_db2_sql_script.sql -o /u01/db2inst1/output_dir/ -d TESTDB -u adminuser -p ******
I don't understand ALTER TABLE "DB2INST1"."EMPLOYEE" ADD CONSTRAINT "PK_EMPLOYEE" PRIMARY KEY ("EMPNO") ENFORCED in an ALTER TABLE section at ./db2topg.pl line 829, line 202.

Hi @vijaysharma212,
Yes, the script is intended to work with CREATE TABLE or ALTER TALE statements.
But depending on DB2 versions, the syntax may not be processed correctly.
It seems to be the case here with the keyword ENFORCED which is not expected by the analysis.
Feel free to suggest improvements.
Or, if you send me your db2 structure dump (or at least the faulting part of it), I can have a look on it to solve the issue. (you can use my email philippe.beaudoin at dalibo.com)

Fixed with commit c52e0d1