db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rusty Wright <ru...@berkeley.edu>
Subject autoincrement
Date Wed, 23 Aug 2006 00:34:56 GMT
How do I specify an autoincrement column such that the generated sql 
works with both mysql and postgresql?  In my database xml file I have

> <?xml version="1.0"?>
> <!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
> 
> <database name="waitlist" defaultIdMethod="native">
>     <table name="waitlist">
>         <column name="waitlist_key"
>                 type="bigint"
>                 size="20"
>                 required="true"
>                 primaryKey="true"
>                 autoIncrement="true"
>         />

When I run this under ant with PostgreSQL it connects to the database 
and gets the following error.  I think it's not creating the sequence 
first.  When I use MySql it does everything without any errors.

> ddlToDatabase] WARNING: SQL Command CREATE TABLE waitlist
> [ddlToDatabase] (
> [ddlToDatabase]     waitlist_key BIGINT NOT NULL UNIQUE DEFAULT nextval('waitlist_waitlist_key_seq'),
> [ddlToDatabase]     facility VARCHAR(20) NOT NULL,
> [ddlToDatabase]     uid VARCHAR(16) NOT NULL,
> [ddlToDatabase]     cn VARCHAR(40) NOT NULL,
> [ddlToDatabase]     type VARCHAR(20) NOT NULL,
> [ddlToDatabase]     platform VARCHAR(8) NOT NULL,
> [ddlToDatabase]     signin_time TIMESTAMP NOT NULL,
> [ddlToDatabase]     PRIMARY KEY (waitlist_key)
> [ddlToDatabase] ) failed with: ERROR: relation "waitlist_waitlist_key_seq" does not exist

Thanks

Mime
View raw message