
November 22nd, 2005, 08:48 AM
| | | PostgreSQL 7.4.1 and pgdb.py
Hi
My box: RedHat 9.0, Pentium III
Recently I upgraded from PostgreSQL 7.3.2 to PostgreSQL 7.4.1.
The PostgreSQL 7.3.2's rpms were installed from RehHat CDs
The PostgreSQL 7.4.1's rpms I used to upgrade were downloaded from RHEL3
subdirectory (of the mirror ftp://ftp4.ar.postgresql.org/pub/mir.../redhat/rhel3).
The upgrade is working well, even I can connect to PostgreSQL from a PHP
script.
Before upgrading I used to connect to PostgresQL using pgdb.py (part of
PyGreSQL that comes with one of the rpms I guess). The sintaxis I was using
from interactive shell were:
---------------[color=blue][color=green][color=darkred]
>>>import pgdb
>>>dbConnect = pgdb.connect(dsn='localhost:oracle', user='manuel',[/color][/color][/color]
password='')[color=blue][color=green][color=darkred]
>>>cursor = dbConnect.cursor()
>>>cursor.execute("select * from address")
>>>while (1):[/color][/color][/color]
.... row = cursor.fetchone()
.... if row == None:
.... break
.... print row
....
['BAILEY','WILLIAM',None,None,None,None,'213-293-0223',None]
['ADAMS','JACK',None,None,None,None,'415-453-7330',None]
-
-[color=blue][color=green][color=darkred]
>>>cursor.close()
>>>dbConnect.close()[/color][/color][/color]
-----------------------
As you can see, the connection and fechting were successful.
But now when I input the same sintaxis with the new Installation(PostgreSQL
7.4.1), I get an error when I enter rhe four line:
----------------[color=blue][color=green][color=darkred]
>>>import pgdb
>>>dbConnect = pgdb.connect(dsn='localhost:oracle', user='manuel',[/color][/color][/color]
password='')[color=blue][color=green][color=darkred]
>>>cursor = dbConnect.cursor()
>>>cursor.execute("select * from address")[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/pgdb.py", line 189, in execute
self.executemany(operation, (params,))
File "/usr/lib/python2.2/site-packages/pgdb.py", line 221, in executemany
desc = type[1:2]+self ._cache.getdescr(typ[2])
File "/usr/lib/python2.2/site-packages/pgdb.py", line 149, in getdescr
self ._source.execute(
_pg.error: ERROR: non exist the column "typprtlen"
------------------
By the way the types of columns from address table are:
lastname varchar(25)
firstname varchar(25)
street varchar(30)
city varchar(15)
state varchar(2)
zip int
phone varchar(12)
ext varchar(5)
My questions:
-Anybody knows why I can't connect to PostgreSQL using the pgdb.py module
now?
- Perhaps the sintaxis has changed?
Manuel Tejada
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend | 
November 22nd, 2005, 08:48 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
> >>>cursor.execute("select * from address")[color=blue]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 189, in execute
> self.executemany(operation, (params,))
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 221, in executemany
> desc = type[1:2]+self ._cache.getdescr(typ[2])
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 149, in getdescr
> self ._source.execute(
> _pg.error: ERROR: non exist the column "typprtlen"[/color]
That's a column in a system catalog table (starts with "pg_"). The
pgdb.py must be trying to access an out of date version of the system
catalog.
You can probably get an updated pgdb.py somehow, or you can just use
"import pg" which has a different interface (non DBAPI-2.0 compliant)
but should work fine (since it doesn't try to access system catalogs,
it's more of a low-level PG interface for python).
In short, the problem exists in pgdb.py, which is trying to access
information in an out-of-date way.
Regards,
Jeff Davis
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org) | 
November 22nd, 2005, 08:48 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
On Fri, Jan 30, 2004 at 07:42:27PM -0800, Jeff Davis wrote:
[color=blue]
> You can probably get an updated pgdb.py somehow, or you can just use
> "import pg" which has a different interface (non DBAPI-2.0 compliant)
> but should work fine (since it doesn't try to access system catalogs,
> it's more of a low-level PG interface for python).[/color]
Keep in mind that there's also psycopg and PyGreSql, as far as Python
interfaces go.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Pido que me den el Nobel por razones humanitarias" (Nicanor Parra)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org) | 
November 22nd, 2005, 08:48 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
> Keep in mind that there's also psycopg and PyGreSql, as far as Python[color=blue]
> interfaces go.[/color]
pg.py and pgdb.py are both part of PyGreSQL. pg.py is the more low-level
interface, closer to a wrapper of libpq (but with lots of helper
functions to make it natural to use in python), and pgdb.py is
PyGreSQL's DBAPI-2.0-compliant interface, which is compatible with other
interfaces in python (so you could swap out another DB for PostgreSQL
without code changes, ideally).
pgdb.py, in compliance with the DBAPI-2.0 spec, does things like match
data types up by using the system catalogs (so you don't have to convert
from text) and has even more features to make it even more natural to
use with python. However, with each version change, pgdb.py needs to be
updated to match the current version of the postgres catalogs, which is
the problem the poster ran into. I think it's supposed to be similar to
JDBC in some respects.
I usually use pg.py, so I might have some details wrong about pgdb.py.
Regards,
Jeff Davis
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match | 
November 22nd, 2005, 08:48 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
"Manuel Tejada" <mantemu@terra.com.pe> writes:[color=blue]
> But now when I input the same sintaxis with the new Installation(PostgreSQL
> 7.4.1), I get an error when I enter rhe four line:[/color]
[color=blue]
> _pg.error: ERROR: non exist the column "typprtlen"[/color]
I believe this indicates you're using an old version of the PyGreSQL
module. typprtlen disappeared from the pg_type system catalog several
releases back. There is updated PyGreSQL code out there, but I'm not
very sure where --- have you looked at gborg.postgresql.org?
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org) | 
November 22nd, 2005, 08:48 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Old version of the PyGreSQL?
Remember I said that I made un apgrade to PostgreSQL version 7.4.1.
One of rpms I used to upgrade is the postgresql-python-7.4.1-1PGDG.i386.rpm.
I suppose that this come with the last version of PyGreSQL.
The README file in /usr/share/doc/postgresql-python-7.4.1 tells that the
module PyGreSQL is version 3.4. This version is the last according to ftp://ftp.druid.net/pub/distrib/
When I use the module C or the module pg.py of PyGreSQL to connect with
PostgreSQL, they work fine.
But I would like to use the pgdb.py too
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Manuel Tejada" <mantemu@terra.com.pe>
Cc: <pgsql-general@postgresql.org>
Sent: Friday, January 30, 2004 11:41 PM
Subject: Re: [GENERAL] PostgreSQL 7.4.1 and pgdb.py
[color=blue]
> "Manuel Tejada" <mantemu@terra.com.pe> writes:[color=green]
> > But now when I input the same sintaxis with the new[/color][/color]
Installation(PostgreSQL[color=blue][color=green]
> > 7.4.1), I get an error when I enter rhe four line:[/color]
>[color=green]
> > _pg.error: ERROR: non exist the column "typprtlen"[/color]
>
> I believe this indicates you're using an old version of the PyGreSQL
> module. typprtlen disappeared from the pg_type system catalog several
> releases back. There is updated PyGreSQL code out there, but I'm not
> very sure where --- have you looked at gborg.postgresql.org?
>
> regards, tom lane[/color]
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives? http://archives.postgresql.org | 
November 22nd, 2005, 08:49 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Manuel Tejada wrote:[color=blue]
>[color=green][color=darkred]
>>>>import pgdb
>>>>dbConnect = pgdb.connect(dsn='localhost:oracle', user='manuel',[/color][/color]
>
> password='')
>[color=green][color=darkred]
>>>>cursor = dbConnect.cursor()
>>>>cursor.execute("select * from address")[/color][/color]
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 189, in execute
> self.executemany(operation, (params,))
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 221, in executemany
> desc = type[1:2]+self ._cache.getdescr(typ[2])
> File "/usr/lib/python2.2/site-packages/pgdb.py", line 149, in getdescr
> self ._source.execute(
> _pg.error: ERROR: non exist the column "typprtlen"
> ------------------[/color]
This is a really old problem already solved on 7.3 see this my post: http://archives.postgresql.org/pgsql...2/msg00082.php
I'm checking that my 7.4.1 installation is affected by the same
problem. I don't understand how this could happen that a modification
made on a 7.3 was not ported to 7.4
For the moment what you can do is substitute this select:
"SELECT typname, typprtlen, typlen "
"FROM pg_type WHERE oid = %s" % oid
inside the file pgdb.py with this one:
"SELECT typname, 4, typlen "
"FROM pg_type WHERE oid = %s" % oid
just to not break all file.
I'm not able to look at CVS to see where the modification was lost.
Regards
Gaetano Mendola | 
November 22nd, 2005, 08:49 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Tom Lane wrote:
[color=blue]
> "Manuel Tejada" <mantemu@terra.com.pe> writes:
>[color=green]
>>But now when I input the same sintaxis with the new Installation(PostgreSQL
>>7.4.1), I get an error when I enter rhe four line:[/color]
>
>[color=green]
>>_pg.error: ERROR: non exist the column "typprtlen"[/color]
>
>
> I believe this indicates you're using an old version of the PyGreSQL
> module. typprtlen disappeared from the pg_type system catalog several
> releases back. There is updated PyGreSQL code out there, but I'm not
> very sure where --- have you looked at gborg.postgresql.org?[/color]
Unfortunately the pgdb.py is wrong and is shipped with
postgresql-python-7.4.1-1PGDG.i386.rpm
this problem was solved already on 7.3
look this: http://archives.postgresql.org/pgsql...2/msg00082.php
something did wrong during the SRPM file building for the 7.4.1
Is a good idea look how this happen.
Regards
Gaetano Mendola | 
November 22nd, 2005, 08:49 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Thank you very much Gaetano
I edited the pgdb.py file setting "4" instead of "typprtlen".
Now I am able to connect to PostgreSQL using pgdb.py.
Just for curiosity, Can I set to -1 too as Gerhard Haring told to you?
----- Original Message -----
From: "Gaetano Mendola" <mendola@bigfoot.com>
Newsgroups: comp.databases.postgresql.general
Cc: "Manuel Tejada" <mantemu@terra.com.pe>
Sent: Sunday, February 01, 2004 4:48 PM
Subject: Re: PostgreSQL 7.4.1 and pgdb.py
[color=blue]
> Manuel Tejada wrote:[color=green]
> >[color=darkred]
> >>>>import pgdb
> >>>>dbConnect = pgdb.connect(dsn='localhost:oracle', user='manuel',[/color]
> >
> > password='')
> >[color=darkred]
> >>>>cursor = dbConnect.cursor()
> >>>>cursor.execute("select * from address")[/color]
> >
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > File "/usr/lib/python2.2/site-packages/pgdb.py", line 189, in execute
> > self.executemany(operation, (params,))
> > File "/usr/lib/python2.2/site-packages/pgdb.py", line 221, in[/color][/color]
executemany[color=blue][color=green]
> > desc = type[1:2]+self ._cache.getdescr(typ[2])
> > File "/usr/lib/python2.2/site-packages/pgdb.py", line 149, in[/color][/color]
getdescr[color=blue][color=green]
> > self ._source.execute(
> > _pg.error: ERROR: non exist the column "typprtlen"
> > ------------------[/color]
>
> This is a really old problem already solved on 7.3 see this my post:
>
> http://archives.postgresql.org/pgsql...2/msg00082.php
>
> I'm checking that my 7.4.1 installation is affected by the same
> problem. I don't understand how this could happen that a modification
> made on a 7.3 was not ported to 7.4
>
> For the moment what you can do is substitute this select:
>
> "SELECT typname, typprtlen, typlen "
> "FROM pg_type WHERE oid = %s" % oid
>
> inside the file pgdb.py with this one:
>
> "SELECT typname, 4, typlen "
> "FROM pg_type WHERE oid = %s" % oid
>
> just to not break all file.
>
> I'm not able to look at CVS to see where the modification was lost.
>
> Regards
> Gaetano Mendola
>
>
>[/color]
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match | 
November 22nd, 2005, 08:49 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Manuel Tejada wrote:[color=blue]
> Thank you very much Gaetano
>
> I edited the pgdb.py file setting "4" instead of "typprtlen".
> Now I am able to connect to PostgreSQL using pgdb.py.
>
> Just for curiosity, Can I set to -1 too as Gerhard Haring told to you?[/color]
I think yes, I really didn't dig on it to see the usage of that
value.
Regards
Gaetano Mendola | 
November 22nd, 2005, 08:52 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
On Friday 30 January 2004 10:59 pm, Alvaro Herrera wrote:[color=blue]
> On Fri, Jan 30, 2004 at 07:42:27PM -0800, Jeff Davis wrote:[color=green]
> > You can probably get an updated pgdb.py somehow, or you can just use
> > "import pg" which has a different interface (non DBAPI-2.0 compliant)
> > but should work fine (since it doesn't try to access system catalogs,
> > it's more of a low-level PG interface for python).[/color][/color]
[color=blue]
> Keep in mind that there's also psycopg and PyGreSql, as far as Python
> interfaces go.[/color]
Since I don't necessarily keep up with what is going on in the Python client
world, would people enlighten me as to which python client would be best to
build RPMs for? I'm going to pull the python subpackage out of the main set,
but I really would like to roll a set for the python clients, unless the
maintainers of those now out of the main tarball clients have their own RPMs.
--
Lamar Owen
Director of Information Technology
Pisgah Astronomical Research Institute
1 PARI Drive
Rosman, NC 28772
(828)862-5554 www.pari.edu
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org | 
November 22nd, 2005, 08:53 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
[color=blue]
>
> Since I don't necessarily keep up with what is going on in the Python client
> world, would people enlighten me as to which python client would be best to
> build RPMs for?[/color]
Well at CMD we only use psycopg as it is the only one we have used that
has proven to:
A. Actually be actively maintained.
B. Have a solid community behind it.
C. It is what Zope (although we don't Zope) uses.
Sincerely,
Joshua D. Drake
I'm going to pull the python subpackage out of the main set,[color=blue]
> but I really would like to roll a set for the python clients, unless the
> maintainers of those now out of the main tarball clients have their own RPMs.[/color]
--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend | 
November 22nd, 2005, 08:53 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
Lamar Owen wrote:[color=blue]
> On Friday 30 January 2004 10:59 pm, Alvaro Herrera wrote:
>[color=green]
>>On Fri, Jan 30, 2004 at 07:42:27PM -0800, Jeff Davis wrote:
>>[color=darkred]
>>>You can probably get an updated pgdb.py somehow, or you can just use
>>>"import pg" which has a different interface (non DBAPI-2.0 compliant)
>>>but should work fine (since it doesn't try to access system catalogs,
>>>it's more of a low-level PG interface for python).[/color][/color]
>
>[color=green]
>>Keep in mind that there's also psycopg and PyGreSql, as far as Python
>>interfaces go.[/color]
>
>
> Since I don't necessarily keep up with what is going on in the Python client
> world, would people enlighten me as to which python client would be best to
> build RPMs for? I'm going to pull the python subpackage out of the main set,
> but I really would like to roll a set for the python clients, unless the
> maintainers of those now out of the main tarball clients have their own RPMs.[/color]
Simply distribute the same files distributed with postgres 7.3.X, what
you did in last 7.4.1 distribution was insert a pre 7.3.2 pgdb.py
IMHO is a pity remove the pyhton subpackage just for a so little mistake.
Regards
Gaetano Mendola | 
November 22nd, 2005, 08:54 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
As a user of PostgreSQL I totally agree with Gaetano Mendola.
There is no reason to pull the python subpackage out of the main set,
----- Original Message -----
From: "Gaetano Mendola" <mendola@bigfoot.com>
To: <pgsql-general@postgresql.org>
Sent: Friday, February 06, 2004 9:24 PM
Subject: Re: [GENERAL] PostgreSQL 7.4.1 and pgdb.py
[color=blue]
> Lamar Owen wrote:[color=green]
> > On Friday 30 January 2004 10:59 pm, Alvaro Herrera wrote:
> >[color=darkred]
> >>On Fri, Jan 30, 2004 at 07:42:27PM -0800, Jeff Davis wrote:
> >>
> >>>You can probably get an updated pgdb.py somehow, or you can just use
> >>>"import pg" which has a different interface (non DBAPI-2.0 compliant)
> >>>but should work fine (since it doesn't try to access system catalogs,
> >>>it's more of a low-level PG interface for python).[/color]
> >
> >[color=darkred]
> >>Keep in mind that there's also psycopg and PyGreSql, as far as Python
> >>interfaces go.[/color]
> >
> >
> > Since I don't necessarily keep up with what is going on in the Python[/color][/color]
client[color=blue][color=green]
> > world, would people enlighten me as to which python client would be best[/color][/color]
to[color=blue][color=green]
> > build RPMs for? I'm going to pull the python subpackage out of the main[/color][/color]
set,[color=blue][color=green]
> > but I really would like to roll a set for the python clients, unless the
> > maintainers of those now out of the main tarball clients have their own[/color][/color]
RPMs.[color=blue]
>
>
> Simply distribute the same files distributed with postgres 7.3.X, what
> you did in last 7.4.1 distribution was insert a pre 7.3.2 pgdb.py
>
>
> IMHO is a pity remove the pyhton subpackage just for a so little mistake.
>
>
> Regards
> Gaetano Mendola
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match[/color]
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org | 
November 22nd, 2005, 08:54 AM
| | | Re: PostgreSQL 7.4.1 and pgdb.py
On Sun, 8 Feb 2004, Manuel Tejada wrote:[color=blue]
>[color=green]
> > Lamar Owen wrote:[color=darkred]
> > > Since I don't necessarily keep up with what is going on in the Python[/color][/color]
> client[color=green][color=darkred]
> > > world, would people enlighten me as to which python client would be best[/color][/color]
> to[color=green][color=darkred]
> > > build RPMs for? I'm going to pull the python subpackage out of the main[/color][/color]
> set,[color=green][color=darkred]
> > > but I really would like to roll a set for the python clients, unless the
> > > maintainers of those now out of the main tarball clients have their own[/color][/color]
> RPMs.
>
> As a user of PostgreSQL I totally agree with Gaetano Mendola.
> There is no reason to pull the python subpackage out of the main set,
>[/color]
The decision to remove all interfaces from the main CVS tree was made in
part to remove the responsibility of the core developers to maintain the
build systems for various components and try to make sure that bugs and
new backend functionality were addressed. While this allows core
developers to focus solely on the backend it puts a lot of pressure on the
packagers to track the various components they are now distributing.
This is not the first packaging problem and it won't be the last if we
rely on a very busy package maintainer to track each independent project.
The only people who really know which version needs to go into an package
are the projects' maintainers.
Asking the interface projects to build and distribute their own packages
is not going to work because they are not likely to have all of the
requirements the existing packagers already have: expertise with the
packaging system, access to machines to build this on a variety of
platforms, and contacts with the upstream package distributors.
Perhaps a system where each project maintainer could register the correct
version of their package to go with each server version. This way in
addition to the hackers email that goes out saying "we're planning on
making the 7.X.X release on Monday" this would also go out to the project
maintainers who would then produce a new version if necessary and register
it on a website somewhere. Then when a packager is ready to produce a
package he can check the website and immediately find for all packages the
correct version of the package to distribute.
Lamar, Oliver, interface maintainers, and others would that be useful?
Kris Jurka
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|