[ 
https://issues.apache.org/jira/browse/DDLUTILS-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12911021#action_12911021
 ] 

Tony Rippy commented on DDLUTILS-246:
-------------------------------------

I've reproduced this issue using PostgreSQL 8.2. I'll try and put together a 
fix.

> JdbcModelReader merges metadata between tables
> ----------------------------------------------
>
>                 Key: DDLUTILS-246
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-246
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core (No specific database)
>    Affects Versions: 1.0
>         Environment: Java 1.5, Oracle 8/9/10/11, DB2 8/9, MSSQL 2000/2005, 
> possibly others
>            Reporter: Frank Jakop
>            Assignee: Thomas Dudziak
>            Priority: Critical
>
> When reading the columns for a table, JdbcModelReader relies on metadata 
> given by DatabaseMetaDataWrapper.
> Given two tables 
> TABLE FOO_MATIC (COL1 INTEGER)
> TABLE FOOTMATIC (COL2 INTEGER, COL3 INTEGER)
> the returned columns for table FOO_MATIC is (COL1, COL2, COL3). No need to 
> say, that subsequent queries on FOO_MATIC fail due to nonexistent columns 
> COL2 and COL3.
> The reason for this behavior is that the underscore is interpreted as a 
> wildcard character in DatabaseMetaData.getColumns(String,String), so both 
> tables match the pattern FOO_MATIC.
> The workaround I use is to re-check the table name in 
> JdbcModelReader.readColumns(DatabaseMetaDataWrapper,String)
>  while (columnData.next())
> {
>     if (columnData.getString("TABLE_NAME").equals(tableName)) 
>     {
>         Map values = readColumns(columnData, getColumnsForColumn());
>         columns.add(readColumn(metaData, values));
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to