DdlUtils
  1. DdlUtils
  2. DDLUTILS-205

Upper case indexed column name causes Exception on readModelFromDatabase call

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: Core - PostgreSql
    • Labels:
      None
    • Environment:
      DB: psql 8.2.3, JDBC: postgresql-8.2-504.jdbc3.jar, OS: Windows XP Pro, DdlUtils: 1.0

      Description

      Consider the following example:


      CREATE TABLE product (
      product_class_id integer NOT NULL,
      product_id integer NOT NULL,
      brand_name character varying(60),
      product_name character varying(60) NOT NULL,
      "SKU" bigint NOT NULL,
      "SRP" numeric(10,4),
      gross_weight real,
      net_weight real,
      recyclable_package boolean,
      low_fat boolean,
      units_per_case smallint,
      cases_per_pallet smallint,
      shelf_width real,
      shelf_height real,
      shelf_depth real
      );

      CREATE INDEX "i_product_SKU" ON product USING btree ("SKU");

      When such DB gets read by calling readModelFromDatabase(.), the following exception happens:

      org.apache.ddlutils.model.ModelException: The index i_product_SKU in table product references the undefined column "SKU"
      at org.apache.ddlutils.model.Database.initialize(Database.java:393)
      at org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:484)
      at org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1920)
      at DdlUtilsExample.main(DdlUtilsExample.java:66)

      While table gets the column name as [SKU], index gets it as ["SKU"]. On checkup in Database.initialize(), indexed column cannot be found by name under given table, and Exception gets thrown.

      It looks like a postgresql bug in JDBC driver that needs a special care in this project.

      1. Issue205.java
        0.7 kB
        Tony Rippy
      2. Issue205.out.txt
        2 kB
        Tony Rippy
      3. Issue205.sql
        0.5 kB
        Tony Rippy

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Thomas Dudziak
            Reporter:
            Andrew S.
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4h
              4h
              Remaining:
              Remaining Estimate - 4h
              4h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development