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
1.02k stars 343 forks source link

Sequence using "CYCLE" definition is changed from source by ora2pg if Oracle START WITH value is HIGHER than MAXVALUE #1588

Closed shane-borden closed 1 year ago

shane-borden commented 1 year ago

In conditions where an Oracle Sequence is about to CYCLE (meaning that the very next value will cycle), the Oracle metadata is stored in such a way where the last value is show as one more than the MAXVALUE. When this ocurs ora2pg is increasing the MAXVALUE by 1 which in essence makes the sequence dissimilar from the source and depending on the datatype the sequence is being used by, could cause failure.

darold commented 1 year ago

Commit 7d03b08 set the START value to MINVALUE value when a sequence is cycled and that the START value is upper that MAXVALUE.