[PyGreSQL] Binding decimal.Decimal

raf raf at raf.org
Wed Sep 24 19:19:37 EDT 2008


raf wrote:

> Christoph Zwerschke wrote:
> 
> > D'Arcy J.M. Cain schrieb:
> >  > I say let's go ahead and make the default Decimal.  We can make it a
> >  > major bump if we want to draw attention to the change.  I suspect that
> >  > few people will be affected anyway.
> > 
> > Ok, PyGresSQL uses Python Decimal for PostgreSQL numeric types now.
> 
> yay! thanks. that's great.
> 
> the website still says 3.8.1 (2 years ago) is the latest version.
> does that get updated or do we need to use cvs?
> ah, and the csv page is broken.
> 
> > Not sure whether we should try to use Python lists for PostgreSQL 
> > arrays. It may be a bit difficult to implement it right (PostgreSQL 
> > arrays can be multi-dimensional and hold different types, and we 
> > probably don't want to use "eval" for security reasons).
> > 
> > -- Christoph
> 
> that's not much of an argument. being a bit difficult is a
> perfect reason to implement it properly it once and for all
> in the database module rather than requiring the module's
> clients to implement it themselves.
> 
> and using eval wouldn't work anyway. it's postgres-specific
> sql array notation, not python. they're not the same thing.
> it has to be parsed and it's much faster to parse it in c
> than python (like my lame half-implementation tht only
> supports 1 dimension because that's all i need right now).
> 
> by the way, a single sql array can't contain elements of
> different types. all elements must be of the same time.
> it sounds like you were saying they could but i might have
> misinterpreted.
> 
> cheers,
> raf

i just came across a wierd example of postgres' sql array notation
that made my little array parser fall over, it looked like:

  [17,35]={NULL,NULL,...,NULL}

where ... was more 16 more 'NULL's

this was some kind of abbreviation i hadn't been expecting.
i wonder if there are any more surprises in store.

cheers,
raf



More information about the PyGreSQL mailing list