db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: Sequence bug in Postgres
Date Thu, 22 Apr 2004 00:53:26 GMT
Shevek wrote:

> It does work fine if you use the idbroker. I suspect that your 
> existing users are using the id broker. Now that I look at the code in 
> further depth, the Velocity templates for postgres look fine, they set 
> up the sequences OK. However, DBPostgres should be using SEQUENCE not 
> AUTO_INCREMENT since the Velocity templates output sequences, not 
> AUTO_INCREMENT, and that this currval should be nextval.

No, we are using "native".

> If you do not use the id broker, then it fails with currval but works
> with nextval. Remember, that setting defaultIdMethod to native still
> leaves you using the idbroker (See other bug), so make a table with
>    486     <table
>    487         name="wordset"
>    488         javaName="Wordset"
>    489         idMethod="native">
>    490    491         <column
>    492             name="id"
>    493             javaName="Id"
>    494             type="INTEGER"
>    495             primaryKey="true"
>    496             autoIncrement="true"
>    497             required="true"
>    498             />
>    499    500         <!-- Torque can't currently cope with generating 
> keys for
>    501              tables with no non-autogenerated columns. -->
>    502         <column
>    503             name="dummy"
>    504             javaName="Dummy"
>    505             type="INTEGER"
>    506             />
>    507     </table>
> and try to insert two instances. Compare the generated schema SQL
> with what the runtime driver is trying to do. It simply doesn't
> add up.  In order to use a sequence, you have to select nextval from
> it. nextval is not selected from any sequence anywhere in the Torque
> source for postgres.
> I think that this is clearly a bug and that it is outstanding. If
> you use the existing code, the insert fails.

Please read this entire thread before posting on this topic again:

Particularly this final message:

which includes:

> Bottom line: you were right, Scott!

I have just added an entry to the wiki to reference this thread:

> I have been randomly assimilating things, but I find the source tends to
> be so much simpler to read and frequently more factual than the
> documentation. I am reading 3.1 source.

This is often true of Open Source projects, though not a valid excuse.  
You contributions in updating the documentation would be most welcome.


Scott Eade
Backstage Technologies Pty. Ltd.

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

View raw message