Sean Laurent wrote:

I already posted about this, but no one responded, so I'll try again.

There is a bug in the PostgreSQL adapter code that Tim Regovich pointed out in December of 2002:
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=590783


The basic idea is that getIDMethodSQL() uses the 'currval' function, which causes problems on inserts with an error messages like 'xxx.currval is not yet defined in this session.'

According to the PostgreSQL documentation, currval() returns "the value most recently obtained by nextval for this sequence in the current session. (An error is reported if nextval has never been called for this sequence in this session.)" Notice the part in parenthesis. For new sessions, nextval() will never have been called and thus currval() won't work.

The proper solution is simply to use nextval() instead of currval(). I was easily able to change this in my copy of the Torque code and my testing indicates that it's now working properly.

What can I do to help make certain this gets fixed in the main Torque development line?

-Sean


You will find if you trace the code that Torque retrieves the id value after the insert takes place and hence currval() is correct.

Using currval() has fewer concurrency issues than using nextval(), I believe this may be why it is used.

Scott

--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to