Bug 143281

Summary: postgresql-python stupid broken
Product: [Fedora] Fedora Reporter: Jack Neely <jjneely>
Component: postgresqlAssignee: Tom Lane <tgl>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: hhorak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-21 19:07:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jack Neely 2004-12-17 23:55:22 UTC
Description of problem:
The postgresql-python bindings are really stupidly broken.  These
weren't QA'd at all.  I've also seen this bug in FC3 betas, will
reporduce in FC3 final when I get it installed.

The pgdb.py gives wrong parameters to the type() function.  Normally,
you realize that any SQL at all breaks and you get the traceback:

Traceback (most recent call last):
  File "/home/slack/projects/current/src/current_apache.py", line 278,
in callAPIMethod
    result = apply(func, params)
  File "/home/slack/projects/current/src/api/cadmin.py", line 55, in
createChannel
    result['msg'] = db.db.makeChannel(channel)
  File "/home/slack/projects/current/src/db/currentdb.py", line 101,
in makeChannel
    (channel['name'],
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 188, in execute
    self.executemany(operation, (params,))
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 209, in
executemany
    raise OperationalError, "internal error in '%s'" % sql
OperationalError: internal error in 'INIT'

On line 209 of pgdb.py if you take out the 'raise OperationalError'
and let it raise what exception the try statement actually received
you get the following traceback:

Traceback (most recent call last):
  File "/home/slack/projects/current/src/current_apache.py", line 278,
in callAPIMethod
    result = apply(func, params)
  File "/home/slack/projects/current/src/api/cadmin.py", line 55, in
createChannel
    result['msg'] = db.db.makeChannel(channel)
  File "/home/slack/projects/current/src/db/currentdb.py", line 101,
in makeChannel
    (channel['name'],
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 188, in execute
    self.executemany(operation, (params,))
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 200, in
executemany
    sql = _quoteparams(operation, params)
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 299, in
_quoteparams
    params = tuple(map(_quote, params))
  File "/usr/lib/python2.3/site-packages/pgdb.py", line 279, in _quote
    elif type(x, (types.IntType, types.LongType, types.FloatType)):
TypeError: type() takes 1 or 3 arguments

There are several calls to type() that need to be fixed.  Please do so.

Version-Release number of selected component (if applicable):
I recently did a yum update after not doing so for a while.  The
busted package on my FC2 system is:  postgresql-python-7.4.6-1.FC2.1

Comment 1 Tom Lane 2004-12-18 20:24:47 UTC
Upstream error :-(

*** This bug has been marked as a duplicate of 142711 ***

Comment 2 Red Hat Bugzilla 2006-02-21 19:07:44 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.