Hi Richard, I am not convinced this is a good solution. The reason is that two processes perform insert at the same that may not return the ID of previous insert but the last one, therefore the same value. I may be wrong.
I have just added to trunk another solution: db.define_table(....,sequence_name='table_pk_Seq') so that you can specify your sequence name. This is compatible to what we do for other databases. Please check it and see if it works for you. Massimo On 1 Lug, 10:39, Richard Vézina <[email protected]> wrote: > Hello Massimo, > > I hired some guys a couples of weeks ago for fixing sequence name issue with > Postgres related to this thread : > > http://groups.google.com/group/web2py/browse_thread/thread/b4577a0347... > > They come with patch to dal.py and sql.py (from the thread actually) and it > work just fine with 1.78.3... I just migrate to 1.79.2 and the flaw with > Postgres sequence is still there. I applied again the patch to the dal.py > and sql.py of the 1.79.2 and it solve the problem. I am using web2py with > those patchs since more of a mounth and I have had no troubles. > > Do you plan to apply them in web2py in the future releases... > > I join my patched dal.py and sql.py of 1.79.2 version... > > Cheers > > Richard > > CC.: Lennon Rubin > > PS.: Here are the changes : > > sql.py changes around line 1935 : > > #the following was updated by Eschaton Systems for dynamic sequence support > on 5/28/2010: > > self._db._execute("""select column_default from > information_schema.columns where > table_name='%s'; """ > THERE IS A LINE BETWEEN HERE... > get_currval_string ='select ' + > self._db._cursor.fetchone()[0].replace('nextval', 'currval') > self._db._execute(get_currval_string) > > dal.py changes around line 1014 : > > def lastrowid(self,tablename): > #the following was updated by Eschaton Systems for dynamic sequence > support on 5/28/2010: > > self.execute("""select column_default from > information_schema.columns where table_name='%s'; """%tablename) > get_currval_string ='select ' + > self.cursor.fetchone()[0].replace('nextval', 'currval') > self.execute(get_currval_string) > > dal.py > 189KVisualizzaScarica > > sql.py > 195KVisualizzaScarica

