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
991 stars 342 forks source link

Indexes not created properly when using COPY #1602

Closed daviesluke closed 1 year ago

daviesluke commented 1 year ago

Example 1

Table created as `CREATE TABLE test1 ( id VARCHAR2(20) NOT NULL, desc VARCHAR2(20) );

CREATE INDEX test1_idx ON test1 ( TO_NUMBER(ID) );`

When running in TABLE mode get the following SQL generated CREATE INDEX test1_idx ON test1 (((nullif(id, '')::numeric)));

When running in COPY mode get the following SQL generated CREATE INDEX test1_idx ON test1 ((id)::numeric);

2nd SQL is invalid.

Example 2

Table created as `CREATE TABLE test2 ( id VARCHAR2(254) NOT NULL, config_path VARCHAR2(254) NOT NULL, start_time TIMESTAMP(6) NOT NULL );

CREATE INDEX test2_idx ON test2 ( config_path, start_time desc );`

When running in TABLE mode get the following SQL generated CREATE INDEX test2_idx ON test2 (config_path, start_time desc);

When running in COPY mode get the following SQL generated CREATE INDEX test2_idx ON test2 (config_path, ("start_time desc"));

2nd SQL is invalid