I just had an inconsistency in db.insert and db.update brought to my 
attention. Previous versions of pygresql accepted the various date literals 
(current_timestamp et al) as values in db.insert() and db.update(). Since the 
new version no longer quotes values, the way these values were massaged 
before is no longer applied. I don't believe there's a loss of functionality 
since you can always use 'now' or 'today', but there's the potential to break 
existing code.

There's something similar for booleans, but all the "true" values listed there 
appear to still work, and the obvious antonyms still work for false. However, 
previously any string not listed as "true" evaluated to false, and any other 
type of python value would be evaluated based on its python boolean. This no 
longer works.

NULL values are also set differently with this version. With the previous 
implementation, "" was inserted as NULL for boolean and money, any value 
which evaluates to false in python was inserted as NULL for dates, and any 
value which evaluates to false except for 0 was inserted as NULL for 
numerics. This doesn't work any more.

I have a patch which sets NULL values and non-string booleans the way they 
were before. There's no reason it couldn't also handle the date literals and 
string booleans -- I personally would prefer not to have that if it's not 
causing major pain for anyone.

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.

-- 
Patrick TJ McPhee <[email protected]>
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to