Re: Bug report: psycopg2 doesn't allow large-object write() for large strings.
Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | initd.org |
| Message-ID | <1249830229.9296.35.camel@erin> |
Il giorno mer, 20/05/2009 alle 16.04 -0700, Will Kraytos ha scritto: > 2009/5/19 Federico Di Gregorio <fog-NGVKUo/i/[email protected]>: > > Il giorno mar, 19/05/2009 alle 14.04 -0700, Will Kraytos ha scritto: > >> >>> import psycopg2 > >> >>> conn = psycopg2.connect('user=postgres') > >> >>> lobject = conn.lobject() > >> >>> lobject.write('*' * 10000) > >> Traceback (most recent call last): > >> File "<stdin>", line 1, in <module> > >> psycopg2.OperationalError > >> >>> lobject.write('*' * 1000) > >> 1000 > >> As you can see, lobject.write(s) works where s is 1KB, but fails for a > >> 10KB string. This is for psycopg 2.0.10. > > > > Thanks. I'll check this one ASAP. > > Thanks a lot. > > BTW, if that helps at all, I've verified the lobject.py example that > comes bundled with psycopg2's source fails for the exact same reason: > > ~/psycopg2-2.0.10/examples$ python lobject.py > Opening connection using dns: dbname=test > Encoding for this connection is UTF8 > Created a new large object with oid 222231 > Manually importing some binary data into the object: > Traceback (most recent call last): > File "lobject.py", line 39, in <module> > len = lobj.write(data) > psycopg2.OperationalError Mm.. this seems to be a problem with the connection starting in non-blocking status. Right now I just added a switch to blocking before writing large data to the LO and it works (even if I don't know exactly why, I guess the LO code does not work well with non-blocking connections..) Anyway, let me know if this raise new problems or just works. federico -- Federico Di Gregorio http://people.initd.org/fog DISCLAIMER. If I receive a message from you, you are agreeing that: 1. I am by definition, "the intended recipient". 2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it on USENET or the WWW. 3. I may take the contents as representing the views of your company. 4. This overrides any disclaimer or statement of confidentiality that may be included on your message. _______________________________________________ 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) iEYEABECAAYFAkp+5VUACgkQvcCgrgZGjeunYgCeJx1o/WRE2kY7f2ZmfCMK1Dd2 djoAoLXZGbM1AdEKaqrd1oqhYxk0DKhH =i+Bj -----END PGP SIGNATURE-----