I'm using Torque 3.1.1 and Postgresql and have run into a problem
related to this thread of discussion. Something seems to be wrong in
this version regarding primary keys and sequences.
If I set my table to use idMethod="native", then torque generates sql
that refers to a non-existence sequence and I can't insert any rows.
If I add autoIncrement="true" to my primary key, then I get working
sql and I can insert rows via psql. BUT I can't insert any rows via
the peer objects, because the generated Java code refers to a
sequence that does not exist.
Has this been fixed in a version since 3.1.1 or is the bug still
outstanding? Are they any postgresql users out there that have run
It seems that in 3.1.1 the only way to use torque is with the id
broker, but I would rather use postgresql sequences.
In early versions of Torque, this was not an issue and things worked
fine with Postgres.
Thanks for your help,
On May 19, 2005, at 6:49 PM, Matt Hughes wrote:
> 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
> 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,
> 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
> 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.