SQL user function returning list for IN clause

Peter Otten __peter__ at web.de
Fri Oct 16 19:27:30 CEST 2009


Felix wrote:

>> Define a function foobar_contains() as follows:
>>
>> def foobar_contains(foo, bar):
>> return foo in foobar(bar)
>>
>> and change the query to
>>
>> select * from table a, table b where foobar_contains(a.foo, b.bar)
> 
> I thought about that (see above), but it would not use an index on
> a.foo which a regular a.foo IN (x,y,z) does.

Sorry for not reading your post carefully.

Peter




More information about the Python-list mailing list