logo       

Re: autoincrement in PostgreSQL: msg#00049

jakarta.turbine.torque.user

Subject: Re: autoincrement in PostgreSQL

Alik Kurdjukov wrote:
Hello!

I found that autoincrement flag on the column is ignored in PostgreSQL backend.

Hi, I've been using PostgreSQL 7 for a long time with Torque, and this schema snippet generates auto incrementing primary keys:

<database name="laser">

<table name="Form" idMethod="native">
<column name="Form_ID" type="INTEGER" required="true" primaryKey="true"/>
<column name="title" type="VARCHAR" size="255"/>
<column name="idcolumn" type="VARCHAR" size="255"/>
...
</table>
</database>

Output SQL:
DROP TABLE Form;
DROP SEQUENCE Form_SEQ;

CREATE SEQUENCE Form_SEQ;

CREATE TABLE Form
(
Form_ID integer DEFAULT nextval('Form_SEQ') NOT NULL,
title varchar (255),
idcolumn varchar (255),
....
PRIMARY KEY (Form_ID)
);


While it doesn't use SERIAL, it has the same effect. The idMethod has to be set to native for this to work (I believe).

--
Matt Hughes
+ mhughe@xxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise