OpenJPA
  1. OpenJPA
  2. OPENJPA-1455

SynchronizeMapping ALTER TABLE ADD COLUMN fails with column already exist exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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

          Donald Woods made changes -
          Fix Version/s 2.0.0-beta3 [ 12314857 ]
          Fix Version/s 2.0.0 [ 12314019 ]
          Fay Wang made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Fay Wang made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Fay Wang added a comment -

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

          Show
          Fay Wang added a comment - Thanks to Milosz for pointing out the problem of getting current schema from DB2.
          Hide
          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 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.
          Milosz Tylenda made changes -
          Field Original Value New Value
          Link This issue relates to OPENJPA-842 [ OPENJPA-842 ]
          Fay Wang created issue -

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development