ModelException thrown when reading columns with "special" names
---------------------------------------------------------------
Key: DDLUTILS-178
URL: https://issues.apache.org/jira/browse/DDLUTILS-178
Project: DdlUtils
Issue Type: Bug
Components: Core - PostgreSql
Affects Versions: 1.0 RC2
Environment: PostgreSQL 8.2 on Ubuntu 7.04. Java 6.
Reporter: Adrián Romero
Assignee: Thomas Dudziak
Trying to execute the method "readModelFromDatabase" a ModelException is
thrown. The database has only one table with a field named "year". If this
field is renamed by another name it works ok. The field "year" appears in the
pgAdmin tool with quotes. This must be the reason why DDLutils throws the
ModelException.
This is the exception thrown:
org.apache.ddlutils.model.ModelException: The index ad_sequence_no_key in table
ad_sequence_no references the undefined column "year"
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.JdbcModelReader.getDatabase(JdbcModelReader.java:432)
at
org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1884)
at
org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1869)
at org.openbravo.ddl.Test.main(Test.java:52)
The database was previously populated with the following XML::
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="openbravo-tests">
<table name="ad_sequence_no">
<column name="ad_sequence_id" primaryKey="false" required="true"
type="NUMERIC" size="10" autoIncrement="false"/>
<column name="year" primaryKey="false" required="true" type="VARCHAR"
size="4" default="0000" autoIncrement="false"/>
<column name="ad_client_id" primaryKey="false" required="true"
type="NUMERIC" size="10" autoIncrement="false"/>
<unique name="ad_sequence_no_key">
<unique-column name="ad_sequence_id"/>
<unique-column name="year"/>
</unique>
</table>
</database>
And in the pgAdmin tool, the table definition is:
-- Table: ad_sequence_no
-- DROP TABLE ad_sequence_no;
CREATE TABLE ad_sequence_no
(
ad_sequence_id numeric(10) NOT NULL,
"year" varchar(4) NOT NULL DEFAULT '0000'::character varying,
ad_client_id numeric(10) NOT NULL
)
WITHOUT OIDS;
ALTER TABLE ad_sequence_no OWNER TO tad;
-- Index: ad_sequence_no_key
-- DROP INDEX ad_sequence_no_key;
CREATE UNIQUE INDEX ad_sequence_no_key
ON ad_sequence_no
USING btree
(ad_sequence_id, "year");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.