[PyGreSQL] Patch to add read support for integer arrays

D'Arcy J.M. Cain darcy at PyGreSQL.org
Fri Mar 21 15:36:17 EDT 2008


On Fri, 21 Mar 2008 20:58:38 +0200
Mikko Korkalo <mikko at korkalo.fi> wrote:
> Hi,
> 
> Here's a unified diff against the CVS version of pgdb.py (1.36).

That's better.  Thanks.

> I also optimized parsing of arrays by using substring instead of 
> string.replace().

Even better, how about eval()?  Of course, we still need to replace the
curlies with squares in that case but then it handles multi-dimensional
arrays as well.

Now, this change will already break programs that are expecting their
query to return a string instead of an array.  If we do decide to do
this perhaps we should replace the curlies with squares right in the C
code now and use eval() for all the array types.

We should also convert the other way when inserting.

> I couldn't test this pgdb.py version properly, seems that it's partly 
> incompatible with the rest of the python/postgresql/pygresql stuff I 
> have on my Ubuntu 7.10 workstation. For example, booleans are broken for 
> some reason.
> Anyway I tested the integer array part, and it seemed to work.
> I suggest that you test this before putting it into production.

We always add to the unit tests.  In fact, we appreciate it when
patches include patches to the unit tests.  I will create a test for
this one and post it here for review.  In fact, let's work out all the
unit test changes first and do this right.

Finally, since this may break existing code, what is everyone's opinion
on doing this in the first place?  Would it be OK if we went to a major
release?

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org


More information about the PyGreSQL mailing list