dalibo/db2topg

VARCHAR column conversion

yhunkim opened this issue · 4 comments

DB2 has various string units (https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_stringunitspec.html)

And an extracted DDL for that column can contain that units.
e.g. "HH" VARCHAR(4 OCTETS),

This causes a table creation command for postgresql to be

hh VARCHAR(4 OCTETS),

this is not understood by postgres create table command..

Thank you.

I've just pushed a patch for this. Please tell me if this fixes it.

The patch changes the VARCHAR(4 OCTETS) to VARCHAR($1), which is not recognized by PSQL create table command.

Also, some of the table names which were double quoted e.g. "DataBaseTable2_e" are all converted to databasetable2_e.

Thank you.

I pushed a correction for varchar…

For the case, yes, for now everything is lowercased. I didn't meet a case sensitive schema for db2 yet. If you have such a schema and really need to keep the case, please send it to me at cousinmarc at gmail.com, so that I can test it properly.

Thank you! This patch works for the VARCHAR case.