db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Laurent <s...@neuronfarm.com>
Subject Problem w/PostgreSQL Insert
Date Mon, 16 Feb 2004 17:21:06 GMT
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/ReadMsg?listName=torque-dev@db.apache.org&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

------------------------------
Programming is an art form that fights back.
------------------------------


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


Mime
View raw message