Hi!<br><br>PGSQL makes me crazy...<br><br>I port my apps to PGSQL, and I near to finish - but I got this problem...<br><br>Params: PGSQL 8.3, Windows, Pylons, PGDB, DBUTILS...<br><br>I opened the connection with DBUTILS. I have one thread (the test thread), possible it have more in the background, I don't know...<br>
<br>See this pseudocode:<br><br>start trs ("rollback; begin;")<br>delete old recs<br>insert new recs<br>commit<br><br>I delete all of old records with:<br>"delete from levelfo where level = :level"<br>
<br>This I do in one transaction that protect the next sequences to.<br><br>Later I want to insert the records, BUT:<br><br> def GetCodes(reks):<br> l = []<br> for rek in reks:<br> l.append(str(rek['KOD']))<br>
return str(l)<br> def LogInsertedReks(Index):<br> csql = "select * from levelfo where level=%d" % self.LevelRek['KOD']<br> self.Cur.execute(csql)<br> reks = dwdb.FetchAll(self.Cur)<br>
<a href="http://self.log.info">self.log.info</a>(Index + ' #### INSERTED REKS ####')<br> <a href="http://self.log.info">self.log.info</a>('%s' % GetCodes(reks))<br><br> for levelforek in self.LevelFoReks:<br>
LogInsertedReks('Start1')<br> LogInsertedReks('Start2')<br> LogInsertedReks('Start3')<br> LogInsertedReks('Start4')<br> LogInsertedReks('Start5')<br>
LogInsertedReks('Start6')<br> kod = levelforek['KOD']<br> <a href="http://self.log.info">self.log.info</a>('#### INSERT ####')<br> <a href="http://self.log.info">self.log.info</a>('%s' % levelforek['KOD'])<br>
LogInsertedReks('Start7')<br> LogInsertedReks('Start8')<br> LogInsertedReks('Start9')<br><br>See this log:<br>18:07:02,276 INFO [xxx] Start1 #### INSERTED REKS ####<br>
18:07:02,276 INFO [xxx] []<br>18:07:02,292 INFO [xxx] Start2 #### INSERTED REKS ####<br>18:07:02,292 INFO [xxx] []<br>18:07:02,292 INFO [xxx] Start3 #### INSERTED REKS ####<br>18:07:02,292 INFO [xxx] []<br>18:07:02,306 INFO [xxx] Start4 #### INSERTED REKS ####<br>
18:07:02,306 INFO [xxx] []<br>18:07:02,306 INFO [xxx] Start5 #### INSERTED REKS ####<br>18:07:02,306 INFO [xxx] []<br>18:07:02,306 INFO [xxx] Start6 #### INSERTED REKS ####<br>18:07:02,306 INFO [xxx] []<br>18:07:02,306 INFO [xxx] #### INSERT ####<br>
18:07:02,306 INFO [xxx] 11551<br>18:07:02,306 INFO [xxx] Start7 #### INSERTED REKS ####<br>18:07:02,306 INFO [xxx] []<br>18:07:02,619 INFO [xxx] Start8 #### INSERTED REKS ####<br>18:07:02,619 INFO [xxx] ['11555', '11556', '11557', '11558']<br>
18:07:02,634 INFO [xxx] Start9 #### INSERTED REKS ####<br>18:07:02,634 INFO [xxx] ['11555', '11556', '11557', '11558']<br>18:07:02,697 INFO [xxx] After UID #### INSERTED REKS ####<br>18:07:02,697 INFO [xxx] ['11555', '11556', '11557', '11558']<br>
<br>As you see, I don't do anything (like db operations), and deleted records are appearing...<br>Hmmmm... possible is it a cursor changing?<br><br>When I change my logger to see the object ids, I can see the cursor changing (in the background):<br>
<br>18:21:29,134 INFO [xxx] Start7 #### INSERTED REKS ####<br>18:21:29,134 INFO [xxx] []<br>18:21:29,134 INFO [xxx] Start7 #### CURSOR INFO ####<br>18:21:29,134 INFO [xxx] [<DBUtils.SteadyDB.SteadyDBCursor instance at 0x01955710>]<br>
18:21:29,134 INFO [xxx] [<DBUtils.SteadyDB.SteadyDBConnection instance at 0x019555A8>]<br>********** 18:21:29,134 INFO [xxx] [<pgdb.pgdbCursor instance at 0x019556E8>] <br>18:21:29,431 INFO [xxx] Start8 #### INSERTED REKS ####<br>
18:21:29,431 INFO [xxx] ['11555', '11556', '11557', '11558']<br>18:21:29,431 INFO [xxx] Start8 #### CURSOR INFO ####<br>18:21:29,431 INFO [xxx] [<DBUtils.SteadyDB.SteadyDBCursor instance at 0x01955710>]<br>
18:21:29,431 INFO [xxx] [<DBUtils.SteadyDB.SteadyDBConnection instance at 0x019555A8>]<br>********** 18:21:29,431 INFO [xxx] [<pgdb.pgdbCursor instance at 0x0195AE18>]<br><br>What happened? How I can avoid the cursor changing? How to fix it in my transaction?<br>
I never ask for new cursor, I used same variable in all of my context (self.Cur)... :-(<br><br>So what is the solution? Drop DBUtils? Or what?<br><br>Thanks for your help:<br> dd<br><br><br><br>