Am 10.12.2015 um 07:25 schrieb D'Arcy J.M. Cain:
Shouldn't it?  Here is a test that I think should pass but currently
does not.

Since DB adapts other types on ingress of insert() and update() as well, that makes sense.

Your patch missed adding the bytea check in the _quote method. The test with insert() only worked because it picked up the result from the first test. I have added the missing bits and improved the tests, and committed already.

The test is incomplete as it should also test update but I believe that
either does the same.

I've included update() in the test now as well.

It should also handle the get method so that we don't need the unescape.

Yes, I'll have a look at that.

It's a larger problem, because it does not only affect bytea, but also the other types. For instance, in the default mode if you pass a bool as True in the dict to insert(), then you will get it back as 't' in the returned dict. Or if you set_bool(True) then, if you pass a 't' in the dict, you will get back True in the returned dict. Both is not really what you expect.

With other words, currently you always get the standard types back, not the type you used on input. Maybe insert() and update() should be improved so that they convert the return values to the same types that have been passed in input, i.e. if you pass 't' you will get 't' and if you pass True you will get True.

-- Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to