Bug #879: python interface broken by removal of pg_type.typprtlen - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #879: python interface broken by removal of pg_type.typprtlen
Date
Msg-id 20030121153014.36599476124@postgresql.org
Whole thread Raw
Responses Re: Bug #879: python interface broken by removal of pg_type.typprtlen  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: "Andrzej Kosmala"
Date:
Subject: Re: "ERROR: Query-specified return tuple and actual function
Next
From: Tom Lane
Date:
Subject: Re: Bug #879: python interface broken by removal of pg_type.typprtlen