You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by ti...@terminaltechnologies.com on 2002/12/30 14:59:08 UTC

DBPostgres

Hello,

Please ignore if this is a redundant find, but I searched the archives
and found nothing apropos.
The Postgres db adapter seems to have an inconsitency in it.
The getSequenceSql(...) method has been deprecated in favor of the
getIDMethodSQL(...) method, yet the methods are not functionally
equivalent.  getSequenceSql() (correctly) uses the 'nextval' function,
while getIDMethodSQL () uses the 'currval' function.  Thisd causes
problems on insert with an error messages like 'xxx.currval is not yet
defined in this session.'
If I change 'currval' to 'nextval', then all seems to work well.

I have attached my patch :

Index: src/java/org/apache/torque/adapter/DBPostgres.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBPostgres.java,v

retrieving revision 1.14
diff -w -r1.14 DBPostgres.java
66c66
<  * @version $Id: DBPostgres.java,v 1.14 2002/12/12 11:28:14 mpoeschl
Exp $
---
>  * @version $Id: DBPostgres.java,v 1.13 2002/09/19 07:54:37 jon Exp $
117c117,129
<         return ("select currval('" + name + "')");
---
>         return ("select nextval('" + name + "')");
>     }
>

Regards,

Tim Regovich
tregovich@terminaltechnologies.com



Re: DBPostgres

Posted by Scott Eade <se...@backstagetech.com.au>.
Tim,

Patches are welcome, but can you please do the following:

1. Create unidiff patch files (cvs diff -u)
2. Create a patch issue in the appropriate module in Scarab
(http://scarab.werken.com/scarab/issues/) that describes the problem and
attach your patch file.  In this case the module would be "Torque > Source".

Thanks,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


On 31/12/2002 12:59 AM, "tim@terminaltechnologies.com"
<ti...@terminaltechnologies.com> wrote:

> Hello,
> 
> Please ignore if this is a redundant find, but I searched the archives
> and found nothing apropos.
> The Postgres db adapter seems to have an inconsitency in it.
> The getSequenceSql(...) method has been deprecated in favor of the
> getIDMethodSQL(...) method, yet the methods are not functionally
> equivalent.  getSequenceSql() (correctly) uses the 'nextval' function,
> while getIDMethodSQL () uses the 'currval' function.  Thisd causes
> problems on insert with an error messages like 'xxx.currval is not yet
> defined in this session.'
> If I change 'currval' to 'nextval', then all seems to work well.
> 
> I have attached my patch :
> 
> Index: src/java/org/apache/torque/adapter/DBPostgres.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBPo
> stgres.java,v
> 
> retrieving revision 1.14
> diff -w -r1.14 DBPostgres.java
> 66c66
> <  * @version $Id: DBPostgres.java,v 1.14 2002/12/12 11:28:14 mpoeschl
> Exp $
> ---
>>  * @version $Id: DBPostgres.java,v 1.13 2002/09/19 07:54:37 jon Exp $
> 117c117,129
> <         return ("select currval('" + name + "')");
> ---
>>         return ("select nextval('" + name + "')");
>>     }
>> 
> 
> Regards,
> 
> Tim Regovich
> tregovich@terminaltechnologies.com
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>