﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14138	Apache setup using sqlite3 breaks when performing a field__regex filter	eternicode	nobody	"Using a simple apache mod_wsgi setup, setting the project to use sqlite3 as the backend, and running {{{MyModel.objects.filter(field__regex=r'')}}} (and later evaluating that query with a {{{.count()}}} ) causes the backend to throw an ""{{{OperationalError: user-defined function raised exception}}}"".

I've managed to trace this to the '{{{import re}}}' statement inside {{{_sqlite_regexp}}} in {{{db/backends/sqlite3/base.py}}}.  After moving that import statement to outside that function (making it a module-level import), the exception is no longer raised and everything works fine.

My specific regex that I initially tried was {{{r'\bfeatured\b'}}} on a django-tagging {{{TagField}}}, but it happened with an empty string ({{{r''}}}) as well.

I noticed this while using 1.1.2.  A quick test with 1.2 confirmed the error shows up there (as a {{{DatabaseError}}}, same message), too.  I haven't tested with SVN.

Strangely, the regex filter works perfectly when run from {{{./manage.py shell}}}, or from the same page viewed on {{{./manage.py runserver}}}.  It's just when it's setup with apache that it has issues for some reason."	Uncategorized	closed	Database layer (models, ORM)	1.2	Normal	fixed	sqlite3 apache operationalerror databaseerror regex	andrew@…	Accepted	0	0	0	0	0	0
