Am 04.01.2013 17:47, schrieb Patrick TJ McPhee:
I just had an inconsistency in db.insert and db.update brought to my
attention.

This seems to be a result of r446, where we added positional parameters to query() and let update() and insert() make use of these instead of using _quote() to inject the values in to the sql string.

Actually in hindsight that patch should have been examined more closely. Our unit tests for update() and insert() obviously were not exhaustive enough so it was a bad idea to rely on these.

And the _quote() method should have been either removed completely, as it is currently not used any more (as far as I see), or it should have been used on the args to get backward compatibility.

What we can do now is create more exhaustive unit tests for update() and insert(), fix the behavior where the old behavior was more reasonable, and document the change where the new behavior makes more sense and backward compatibility does not matter.

I'll look into that this weekend.

While I'm reporting things, I found the change in return values from
getnotify() has broken pgnotify. pgnotify hasn't changed since 2001
and doesn't appear to be on the net any more -- it provides a class
that selects on db.fileno() and calls a callback function with the
results of getnotify(), but it provides a convenient interface for
processing notifications synchronously.

The change is that getnotify() now returns a 3-tuple instead of a 2-tuple, with a payload string (new in Pg 9) as the third item.

Yes, pgnotify seems to have disappeared from the web, but I found an old copy of pgnotify somewhere in a dark corner. getnotify() is used here like that:

                notice = self.pgconn.getnotify()
                if notice is None:
                    pass
                event, pid = notice

You can fix it by changing the last line to event, pid = notice[:2].

Maybe we should add the functionality of pgnotify() to PyGreSQL?

-- Chris


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

Reply via email to