transmogrify fails for types because sequence reset happens out of order

XMLWordPrintable

      Transmogrification of some Registry 4.3.1 data is failing after the types table has been processed and the 'postTable' hook is evaluated and calls insertPronounTypes() because at that point the primary key sequence types_id_seq is still set to value 1:

      biocommons_registry_dev=> select count(*) from types;
       count 
      -------
         226
      (1 row)biocommons_registry_dev=> select * from types_id_seq;
       last_value | log_cnt | is_called 
      ------------+---------+-----------
                1 |      32 | t
      (1 row)
       

      When insertPronounTypes() attempts to insert rows it finds

      <error>2023-12-04 04:58:11 error: [PDOException] SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "types_pkey"
      DETAIL:  Key (id)=(1) already exists. in /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php on line 180
      Stack Trace:
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php:180
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Connection.php:360
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php:70
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Connection.php:363
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Query.php:255
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:2077
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:1970
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:1869
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:1556
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Connection.php:709
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:1557
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:1870
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:2249
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Database/Connection.php:709
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:2255
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/ORM/Table.php:2204
      - /srv/comanage-registry/app/src/Model/Table/TypesTable.php:198
      - /srv/comanage-registry/app/src/Command/TransmogrifyCommand.php:927
      - /srv/comanage-registry/app/src/Command/TransmogrifyCommand.php:711
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php:189
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:334
      - /srv/comanage-registry/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:172
      - /srv/comanage-registry/app/bin/cake.php:12
      </error>
       

            Assignee:
            Benn Oshrin (internet2.edu)
            Reporter:
            Scott Koranda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: