Oracle autoinc_trg causing error: ORA-04091: table xxx is mutating, trigger/function may not see it
I'm using oracledb with knex 0.12.9. When trying to insert data into the table created by the code below
knex.schema.createTable('LOCATIONS', function(table) { table.increments('ID'); table.string('A').unique().notNullable(); table.string('B'); table.string('C'); table.string('D'); table.string('E'); })
I get the following error:
Knex:warning - migrations failed with error: INSERT INTO LOCATIONS (A, B, C, D, E) SELECT A, B, C, D, E FROM OLD_LOCATIONS - ORA-04091: table LOCATIONS is mutating, trigger/function may not see it ORA-06512: at "locations_autoinc_trg", line 1 ORA-04088: error during execution of trigger 'locations_autoinc_trg'
I think this issue was introduced by #1526 . The code added for this changes the autoinc trigger to run a select on the table being modified.
Is there a work around for this issue?
Source: knex/knex