You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Robert Einsle <ro...@einsle.de> on 2005/11/23 14:23:44 UTC

Problems using autoIncrement with primary Key

Hy List,

i have an another Problem using DDL-Utils.

The Base XML-Document is:

--- cut ---
  <database name="re_test">
    <table name="arbeitstage">
      <column name="jahr" primaryKey="true" required="true" 
type="BIGINT" size="8" autoIncrement="true" />
      <column name="monat" primaryKey="true" required="true" 
type="SMALLINT" size="2" autoIncrement="true" />
      <column name="tage" required="true" type="BIGINT" size="8" />
      <column name="feiertage" required="true" type="BIGINT" size="8" />
      <column name="wochenende" required="true" type="BIGINT" size="8" />
      <column name="arbeitstage" required="true" type="BIGINT" size="8" />
      <column name="monat_zahl" required="true" type="BIGINT" size="8" />
    </table>
    <table name="drucken">
      <column name="id" primaryKey="true" required="true" type="INTEGER" 
size="4" autoIncrement="true" />
      <column name="datum" required="true" type="DATE" size="4" />
      <column name="pers_nr" required="true" type="VARCHAR" size="50" />
      <column name="uhrzeit" required="true" type="VARCHAR" size="50" />
      <column name="zeiten" required="true" type="NUMERIC" size="4,2" />
      <column name="beschreibung" required="true" type="VARCHAR" 
size="2000" />
      <column name="abrechnung" required="false" type="BIT" size="1" />
      <column name="abgerechnet" required="false" type="BIT" size="1" />
      <!-- <foreign-key foreignTable="rechnung">
        <reference local="id" foreign="id"/>
      </foreign-key>  -->
    </table>
  </database>
--- cut ---

this generates me two Tables:

--- cut ---
CREATE TABLE arbeitstage
(
  jahr int8 NOT NULL DEFAULT nextval('arbeitstage_jahr_seq'::regclass),
  monat int2 NOT NULL DEFAULT nextval('arbeitstage_monat_seq'::regclass),
  tage int8 NOT NULL,
  feiertage int8 NOT NULL,
  wochenende int8 NOT NULL,
  arbeitstage int8 NOT NULL,
  monat_zahl int8 NOT NULL,
  CONSTRAINT arbeitstage_jahr_key UNIQUE (jahr),
  CONSTRAINT arbeitstage_monat_key UNIQUE (monat)
) ;
CREATE TABLE drucken
(
  id int4 DEFAULT nextval('drucken_id_seq'::regclass),
  datum date NOT NULL,
  pers_nr varchar(50) NOT NULL,
  uhrzeit varchar(50) NOT NULL,
  zeiten numeric(4,2) NOT NULL,
  beschreibung varchar(2000) NOT NULL,
  abrechnung bool,
  abgerechnet bool,
  CONSTRAINT drucken_id_key UNIQUE (id)
) ;
--- cut ---

if i remove the autoIncrement Statements, then the Primary Keys are 
created, of not, only Unique Keys are created.

Where is the Error?

Thanks

Greetings

Robert



Re: Problems using autoIncrement with primary Key

Posted by Thomas Dudziak <to...@gmail.com>.
On 11/23/05, Robert Einsle <ro...@einsle.de> wrote:

> i have an another Problem using DDL-Utils.

<snip>

> if i remove the autoIncrement Statements, then the Primary Keys are
> created, of not, only Unique Keys are created.

Think this is the same error as DDLUTILS-47
(http://issues.apache.org/jira/browse/DDLUTILS-47).

Tom