Uploaded image for project: 'Teiid Designer'
  1. Teiid Designer
  2. TEIIDDES-1211

Exporting DDL for Postgres produces invalid CREATE INDEX statement because duplicate object names in database

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.2
    • 7.4.2
    • Import/Export
    • None

    Description

      Trying to execute DDL on postgres database produces this error:

      Error: ERROR: relation "orders" already exists
      SQLState: 42P07
      ErrorCode: 0
      Error occured in:
      CREATE INDEX ORDERS ON ORDERS (O_CUSTKEY)


      The problem was resolved if I changed ORDERS index name:

      CREATE INDEX ORDERS_IDX ON ORDERS (O_CUSTKEY);


      Here's a statement I found on the Postgres Naming rules:
      The names of all objects must be unique within some scope. Every database must have a unique name; the name of a schema must be unique within the scope of a single database, the name of a table must be unique within the scope of a single schema, and column names must be unique within a table. The name of an index must be unique within a database.

      I would like to suggest that all index names that are created are appended with "idx" or something similar. Right now, the first looks to be the name of the table, and subsequent names have 1,2, etc. appended.

      Attachments

        Activity

          People

            blafond Barry LaFond
            van.halbert Van Halbert (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: