Hi,
I've run into problems with a script of mine that used to work a few
months back. I've
apt-get dist-upgraded my debian sarge box since so I'd guess it's either
a new postgresql
or a new python-pgsql. I've tried using pypgsql 2.4.0-7 & 2.4.0-5 from
debian, with postgresl
versions v7.5.15 and 7.4.7-6sarge1.
The script does an Insert into a table, then attempts to read entries
(there should only be one)
from that table for the key value i've just inserted.
here's some code snippets.
try:
cur.execute("INSERT INTO xmltv.channels (chan_id) VALUES ( '%s'
)" % channel["channel_id"] )
cOid = getChannelOid( channel["channel_id"] )
def getChannelOid( cOID):
try:
cur.execute( "SELECT chan_oid FROM xmltv.channels where
chan_id='%s'" % cOID )
The library barfs on the SELECT statement, an error occurs and the
library tries to rollback the transaction.
The item it is trying to do a select on has definately been added to the
table because if I do a db.commit() here
and abort I can see it still in the database. Also if I enter the
commands from the postgresql.log into psql manually
it works and returns the correct result.
Here's the python traceback of the failed select:
File "./parse.py", line 63, in getChannelOid
cur.execute( "SELECT chan_oid FROM xmltv.channels where chan_id=4" )
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 3086,
in execute
self.__makedesc__()
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2826,
in __makedesc__
_tn, _pl, _ia, _bt = _cache.getTypeInfo(_typ)
File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 886, in
getTypeInfo
raise Warning, self.__conn.notices.pop()
libpq.Warning: LOG: statement: BEGIN WORK
From the postgresql.log I can see (just before the rollback)
STATEMENT: SELECT typname, -1 , typelem FROM pg_type WHERE oid = 20
2006-03-28 14:45:42 [32097] DEBUG: StartTransactionCommand
STATEMENT: ROLLBACK WORK
2006-03-28 14:45:42 [32097] LOG: statement: ROLLBACK WORK
Is -1 a valid input into this SELECT?
thanks a lot for any help you can provide,
Greg
|