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.
Bug in the PostgreSQL query for the number of unique constraints.
In file Ora2Pg.pm within the [TEST INDEXES COUNT] section, the query used is:
$sql = qq{SELECT tn.nspname||'.'||t.relname, count(*)
FROM pg_index i
JOIN pg_class c on c.oid = i.indexrelid
JOIN pg_namespace n on n.oid = c.relnamespace
JOIN pg_class t on t.oid = i.indrelid
JOIN pg_namespace tn on tn.oid = t.relnamespace
WHERE 1=1 $exclude_unique $schema_cond
GROUP BY tn.nspname, t.relname
};
This is exactly the same as the query used in section [TEST UNIQUE CONSTRAINTS COUNT]:
$sql = qq{SELECT tn.nspname||'.'||t.relname, count(*)
FROM pg_index i
JOIN pg_class c on c.oid = i.indexrelid
JOIN pg_namespace n on n.oid = c.relnamespace
JOIN pg_class t on t.oid = i.indrelid
JOIN pg_namespace tn on tn.oid = t.relnamespace
WHERE 1=1 $exclude_unique $schema_cond
GROUP BY tn.nspname, t.relname
};
This appears to be a cut & paste error.
The actual PostgreSQL query for the number of UNIQUE CONSTRAINTS should leverage pg_constraint with the contype = 'u' predicate.
Fix for this issue has been developed and is being tested. PR to this issue is forthcoming.
Bug in the PostgreSQL query for the number of unique constraints.
In file Ora2Pg.pm within the
[TEST INDEXES COUNT]
section, the query used is:This is exactly the same as the query used in section
[TEST UNIQUE CONSTRAINTS COUNT]
:This appears to be a cut & paste error.
The actual PostgreSQL query for the number of UNIQUE CONSTRAINTS should leverage
pg_constraint
with thecontype = 'u'
predicate.Fix for this issue has been developed and is being tested. PR to this issue is forthcoming.