On Mar 27, 2014, at 4:38 PM, Chris Friesen <chris.frie...@windriver.com> wrote:

> On 03/27/2014 04:47 PM, Chris Friesen wrote:
> 
>> Interestingly, unit test
>> nova.tests.api.openstack.compute.contrib.test_server_groups.ServerGroupTest.test_display_members
>> passes just fine, and it seems to be running the same sqlalchemy code.
>> 
>> Is this a case where sqlite behaves differently from mysql?
> 
> Sorry to keep replying to myself, but this might actually hit us other places.
> 
> Down in db/sqlalchemy/api.py we end up calling
> 
> 
> query = query.filter(column_attr.op(db_regexp_op)('None’))

Sqlalchemy handles mapping None to NULL in many cases, so it appears that the 
problem is that we are passing
None as a string here?

Vish

> 
> 
> When using mysql, it looks like a regexp comparison of the string 'None' 
> against a NULL field fails to match.
> 
> Since sqlite doesn't have its own regexp function we provide one in 
> openstack/common/db/sqlalchemy/session.py.  In the buggy case we end up 
> calling it as regexp('None', None), where the types are "unicode" and 
> "NoneType".  However, we end up converting the second arg to text type before 
> calling reg.search() on it, so it matches.
> 
> Chris
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev@lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to