Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1455

SynchronizeMapping ALTER TABLE ADD COLUMN fails with column already exist exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0-beta3
    • Component/s: jdbc
    • Labels:
      None

      Description

      SynchronizeMapping ALTER TABLE ADD COLUMN fails with column already exist exception. The failure happens when there are multiple tables with the same name but in different schema. When OpenJPA detects a missing column from one table with schema X, it tried to to add the column to another table in default schema, resulting in column already exist exception.

        Issue Links

          Activity

          Hide
          milosz Milosz Tylenda added a comment -

          Hi Fay, I have a few concerns with the committed code:

          1. Do schema generation and other things work if you specify DB2 JDBC URL property currentSchema=my_schema? Does metaData.getUserName() return "my_schema" in this case?
          2. If the above is false, have you considered issuing "VALUES CURRENT SCHEMA" query instead of calling "metaData.getUserName()"?

          In other words, I am afraid that the current schema not always equals user name with DB2 (and maybe some other databases also) and whether by fixing this issue we are creating another one.

          Show
          milosz Milosz Tylenda added a comment - Hi Fay, I have a few concerns with the committed code: 1. Do schema generation and other things work if you specify DB2 JDBC URL property currentSchema=my_schema? Does metaData.getUserName() return "my_schema" in this case? 2. If the above is false, have you considered issuing "VALUES CURRENT SCHEMA" query instead of calling "metaData.getUserName()"? In other words, I am afraid that the current schema not always equals user name with DB2 (and maybe some other databases also) and whether by fixing this issue we are creating another one.
          Hide
          faywang Fay Wang added a comment -

          Thanks to Milosz for pointing out the problem of getting current schema from DB2.

          Show
          faywang Fay Wang added a comment - Thanks to Milosz for pointing out the problem of getting current schema from DB2.

            People

            • Assignee:
              faywang Fay Wang
              Reporter:
              faywang Fay Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development