db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Hughes <mhu...@uvic.ca>
Subject Re: Example problem
Date Fri, 20 May 2005 01:49:42 GMT
First, I must say that I misread part of the error message you had in
your last message, which I think may have lead to some confusion. It
says that an implicit *index* was created, which I misread as *sequence*.

The problem is still that what ever the default value torque used for
the primary key column was already used when you tried to .save() the

Let me clarify that indexes and sequences are two separate things;
sequences are used for automatically generating primary key values, and
indices are used to help speed row access.

Jakub Piechnik wrote:
> Oki, but can I check index value from the Torque level? If so - how? 

You can, but you may not need to do this. See below.

> And is it possible to switch off automate indexing in postgresql?

Torque does provide the id broker, but I have not used it, so I cannot
offer any advice there. I highly recommend using PostgreSQL's sequences.

You can change how primary keys are managed by setting the idMethod
(note capital M) attribute of the table tag, or by setting the
defaultIdMethod on the database tag in the schema file.

<database name="example" defaultIdMethod="native">
<table name="Customer" idMethod="native">

The available settings for idMethod are listed here:

Try using "native". That should make Torque use PostgreSQL's sequences
(so you should see a NOTICE that a sequence has been created, if I
remember correctly).

>From the table schema you sent, and from re-reading your previous
message, it doesn't seem that any id management was used, So give
idMethod="native" a shot.

> I've tried such definition:
>  <table name="publisher" description="Publisher Table" idMethod="native">
>     <column
>       name="publisher_id"
>       required="true"
>       primaryKey="true"
>       type="INTEGER"
>       description="Publisher Id"/>
>     <column
>       name="name"
>       required="true"
>       type="VARCHAR"
>       size="128"
>       description="Publisher Name"/>
>   </table>

 Matt Hughes
  + mhughe@uvic.ca
  + http://spacemonkeys.ca/

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message