Uploaded image for project: 'DdlUtils'
  1. DdlUtils
  2. DDLUTILS-192

Model exception thrown when index references an undefined column

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      org.apache.ddlutils.model.ModelException: The index in table references the undefined column is thrown when referencing a column that exists but is referenced in Postgres incorrectly.

      Column type exists in a table. In an index, however, type is stored as "type". The quotes ("") disallow Java from finding the column.

      The fix is simple:
      add name = name.replace("\"", ""); to the very top of findColumn(String name, boolean caseSensitive) in org.apache.ddlutils.model.Table

      1. Table.java
        22 kB
        Sebastian Niezgoda

        Activity

        Hide
        sniezgoda Sebastian Niezgoda added a comment -

        Attached is a modified Table.java.

        Show
        sniezgoda Sebastian Niezgoda added a comment - Attached is a modified Table.java.
        Hide
        tomdz Thomas Dudziak added a comment -

        How does PostgreSQL reference the column incorrectly ? Could you perhaps post some table creation SQL that leads to this error ?

        Show
        tomdz Thomas Dudziak added a comment - How does PostgreSQL reference the column incorrectly ? Could you perhaps post some table creation SQL that leads to this error ?
        Hide
        sniezgoda Sebastian Niezgoda added a comment -

        Sure. We have a DDL we create the DB from. The relevant line reads:

        Create index idx on table using btree (data_id,type);

        Here's an export of that index from Squirrel SQL:

        index_qualifier,index_name,ordinal_position,column_name,asc_or_desc,non_unique,type,cardinality,pages,filter_condition
        <Other>,idx,2,"type",<Other>,true,3,0,1,<Other>

        Notice the "" around type.

        Show
        sniezgoda Sebastian Niezgoda added a comment - Sure. We have a DDL we create the DB from. The relevant line reads: Create index idx on table using btree (data_id,type); Here's an export of that index from Squirrel SQL: index_qualifier,index_name,ordinal_position,column_name,asc_or_desc,non_unique,type,cardinality,pages,filter_condition <Other>,idx,2,"type",<Other>,true,3,0,1,<Other> Notice the "" around type.
        Hide
        jivers Jim Ivers added a comment -

        I noticed while using Sybase that indexes created by dbo were OK, but user created indexes on user created tables were not:

        create nonclustered index someuser.idex1 on someuser.sometable ( somecolumn ) with max_rows_per_page = 74 on 'default'

        Could not read the schema from the specified database: The index idex1 in table sometable references the undefined column somecolumn

        Show
        jivers Jim Ivers added a comment - I noticed while using Sybase that indexes created by dbo were OK, but user created indexes on user created tables were not: create nonclustered index someuser.idex1 on someuser.sometable ( somecolumn ) with max_rows_per_page = 74 on 'default' Could not read the schema from the specified database: The index idex1 in table sometable references the undefined column somecolumn
        Hide
        sun2walsunil sunil added a comment -

        Dear Thomas Dudziak

        Can u send me the ddutils-1.1.jar
        please its urgent for me
        b'coz i have same problem while configuring symmetricDS2.0.x version
        in postgresql 8.0 and 8.2 primary key shows index as ("first column",second)
        means column name in ("")
        and throws the same exception

        waiting for ur reply

        Show
        sun2walsunil sunil added a comment - Dear Thomas Dudziak Can u send me the ddutils-1.1.jar please its urgent for me b'coz i have same problem while configuring symmetricDS2.0.x version in postgresql 8.0 and 8.2 primary key shows index as ("first column",second) means column name in ("") and throws the same exception waiting for ur reply

          People

          • Assignee:
            tomdz Thomas Dudziak
            Reporter:
            sniezgoda Sebastian Niezgoda
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development