Skip site navigation (1) Skip section navigation (2)

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

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #879: python interface broken by removal of pg_type.typprtlen
Date: 2003-01-21 15:30:14
Message-ID: 20030121153014.36599476124@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Peter Harris (peter(dot)harris(at)kyndal(dot)co(dot)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


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2003-01-21 15:38:36
Subject: Re: Bug #879: python interface broken by removal of pg_type.typprtlen
Previous:From: AverkDate: 2003-01-21 01:08:44
Subject: stored procedure namespace bug (critical) + COALECSE notice

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group