Skip to content

Migrator fails when creating UNIQUE indexes because it attempts to create them twice #43

Description

@philip-stoev

The backup.cat contains the following:

          <column name="CORPID">
            <type code="4" name="integer" size="4" precision="9" scale="0"/>
          </column>
          <column name="CORPNAME">
            <type code="12" name="varchar" size="25" precision="25" scale="0"/>
          </column>
          <column name="CORPDESC" nullable="true">
            <type code="2005" name="clob" size="8" precision="100" scale="0"/>
          </column>
          <column name="CORPFBITS" nullable="true">
            <type code="-5" name="bigint" size="8" precision="19" scale="0"/>
          </column>
          <column name="CORPADDFS" nullable="true">
            <type code="2004" name="binary varying" size="50" precision="50" scale="0"/>
          </column>
          <column name="CREATIONTIME" nullable="true">
            <type code="93" name="timestamp" size="12" precision="16" scale="6"/>
          </column>
          <column name="LASTMODTIME" nullable="true">
            <type code="-5" name="bigint" size="8" precision="19" scale="0"/>
          </column>
          <primary-key name="CORPINFO..PRIMARY_KEY">
            <column name="CORPID"/>
          </primary-key>
          <index name="CORPINFO_CORPNAME" unique="true">
            <column name="CORPNAME"/>
          </index>
          <index name="CORPINFO_CORPFBITS" unique="false">
            <column name="CORPFBITS"/>
          </index>
          <index name="CORPINFO_LASTMODTIME" unique="false">
            <column name="LASTMODTIME"/>
          </index>
        </table>

This causes migrator to generate the following DDL:

CREATE TABLE "CORPINFO" ("CORPID" INTEGER NOT NULL, "CORPNAME" VARCHAR(25) NOT NULL UNIQUE, "CORPDESC" CLOB, "CORPFBITS" BIGINT, "CORPADDFS" VARBINARY(50), "CREATIONTIME" TIMESTAMP(6), "LASTMODTIME" BIGINT);
CREATE UNIQUE INDEX "IDX_Corpinfo_corpinfo_corpname" ON "dg"."CORPINFO" ("CORPNAME");
...

Which fails because we do not allow multiple identical indexes on the same table. MIgrator should have only created a single index, so either use the UNIQUE keyword in CREATE TABLE or use CREATE UNIQUE INDEX, but not both.

The entire dump directory is available from bidata:///space/builds/nuo_datasets/SubDBdump.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions