Re: psycopg2 NaN and Inf

Federico Di Gregorio <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Debian
Message-ID <1232665900.3813.9.camel@mila>
I put psycopg mailing list in cc because people there can be interested.

Il giorno mar, 20/01/2009 alle 16.32 +0100, Markus Demleitner ha scritto:
> psycopg2 has a problem quoting the special IEEE float values NaN and
> Inf, as you can see by trying
> 
> import psycopg2
> 
> conn = psycopg2.connect("dbname='gavo'")
> c = conn.cursor()
> c.execute("CREATE TABLE foo (a REAL, b REAL)")
> try:
>         c.execute("INSERT INTO foo (a, b) VALUES (%(a)s, %(b)s)",
>                 {"a": float("NaN"), "b": float("Inf")})
> except psycopg2.ProgrammingError:
>         print c.query
> 
> (tried that for the psycopg 2.0.6 plus debian and timeout patches,
> but 2.0.8 doesn't seem to contain any isNaN either).

This is now fixed in bzr trunk. float types were adapted using the AsIs
adapter so I did the right thing and added a float adapter. See files:

adapter_pfloat.c
adapter_pfloat.h

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
                        Ahr ahr ahr! E mo' me'e magno tutte! -- Er bieco

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkl4/SwACgkQvcCgrgZGjeuFpACgx4mpmrFXUtPDPm/aG0lXSTTd
qDYAn27LIIPNntFs5G6NE3ZRkkuKXHc+
=c7vG
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.