Bug #879: python interface broken by removal of pg_type.typprtlen

Started by PostgreSQL Bugs Listabout 23 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Peter Harris (peter.harris@kyndal.co.uk) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
python interface broken by removal of pg_type.typprtlen

Long Description
Version 7.3.1, pg_type seems to no longer have a column called typprtlen. This is OK by me, as that column is considered 'unused'.

However:
src/interfaces/python/pgdb.py expects it to be there, (line 150):
"SELECT typname, typprtlen, typlen "
"FROM pg_type WHERE oid = %s" % oid

ALL queries through pgdb.py fail with a traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/free/lib/python2.2/site-packages/pgdb.py", line 189, in execute
self.executemany(operation, (params,))
File "/free/lib/python2.2/site-packages/pgdb.py", line 221, in executemany
desc = typ[1:2]+self.__cache.getdescr(typ[2])
File "/free/lib/python2.2/site-packages/pgdb.py", line 149, in getdescr
self.__source.execute(
_pg.error: ERROR: Attribute "typprtlen" not found

The field is returned as part of the return value of the cursor.description() method for Python's DB API v2.0, but I
don't know of any requirement for what the value is.

Accordingly, I am working around this by replacing with:
"SELECT typname, typlen as typprtlen, typlen "
in pgdb.py

Sample Code
python

import pgdb
db=pgdb.connect(host=...,database=...,user=...,password=...)
cur=db.cursor()
cur.execute("select * from some_table")

... dies with traceback, as described.

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #879: python interface broken by removal of pg_type.typprtlen

pgsql-bugs@postgresql.org writes:

python interface broken by removal of pg_type.typprtlen

Yeah, this is known and already fixed. But thanks for the report.

regards, tom lane