Bug? if PyGreSQL, inserttable is used followed by a for loop

Anton Setzer a.g.setzer at swansea.ac.uk
Fri May 10 16:38:06 EDT 2002


Hi all,

I had the following strange behaviour of python,
which seems to be a bug, either in pygresql or in python itself.

It happens when accessing postgresql
through the module pg (PyGreSQL-3.2):
After using inserttable, for-loops do no longer work.


Here is an example session:

I created a database marksadmin1 with no tables 
(adding a table kullm (e.g. CREATE TABLE kullm (stud text);) doesn't
make any difference).

Then when executing the following python program:

import pg
conn = pg.DB('marksadmin1')
for j in []:
    print j
conn.inserttable("kullm",[])
for j in []:
    print j
conn.close()

I get the following strange errormessage at the line with the 
second "for j in []"-loop (the first for-loop is okay): 

IndexError: list index out of range


I am using python 2.2.1, PyGreSQL-3.2, postgresql version 7.2.1.


The error seems to occur after any execution of inserttable 
(whether with an empty list or not) followed by arbitrary many
commands followed by any "for j in mylist:"-loop.

I have asked D'Arcy J.M. Cain, the current maintainer of  
PyGreSQL-3.2, who wasn't able to repeat that bug. However
my installation seems to be the latest non-beta release and
I haven't encountered any other bugs yet. 

Does anybody encounter the same problem? Or does anybody
know what's wrong or what to do about it.

Thanks for your time

Anton Setzer



-- 
-----------------------------------------------------------------------------
Anton Setzer                            Telephone:
Department of Computer Science          (national)        (01792) 513368 
University of Wales Swansea             (international) +44 1792  513368
Singleton Park                          Fax:
Swansea SA2 8PP                         (national)        (01792) 295651
UK                                      (international) +44 1792  295651
                                        
Visiting address:                       Email: a.g.setzer at swan.ac.uk
Faraday Building,                       WWW:
Computer Science Dept.                 http://www-compsci.swan.ac.uk/~csetzer/ 
2nd floor, room 211.                                                          
------------------------------------------------------------------------------
 
                    
  



More information about the Python-list mailing list