[openstack-dev] [nova] [bug] unit tests sqlite regexp() function doesn't behave like mysql

Chris Friesen chris.friesen at windriver.com
Mon Mar 31 15:49:21 UTC 2014


On 03/31/2014 09:24 AM, Solly Ross wrote:
> IMHO,Stringifying None and then expecting the *string* to match NULL is wrong.
> Could we check to see if `filters[filter_name]` is None and deal with that case separately
> (i.e `if filters[filter_name] is None:
>            filter = column_is_null_check
>        else:
>            filter = column_attr.op(db_regexp_op)(
>                                    str(filters[filter_name]))`)?

I think we actually should do two separate things.

1) As you suggest, we should special-case testing for "None".  I'm not 
sure that it should be in regex_filter(), it might make more sense to do 
it in instance_get_all_by_filters() and add a comment to regex_filter() 
that it doesn't match "None".

2) The sqlite regexp() function should be modified to behave like mysql 
regexp() so that we don't trigger other mismatches in the future.

Chris



More information about the OpenStack-dev mailing list