﻿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
30016	Test regressions with sqlite3 3.26.0 (vs 3.25.3)	Chris Lamb	nobody	"Hi,

In Debian, I am seeing the following test failure since upgrading
`libsqlite3-0` from `3.25.3` (currently in buster) to `3.26.0`.
 
With `libsqlite3-0 (3.26.0-1)`:

{{{
  $ cd tests
  $ PYTHONPATH=.. python3 ./runtests.py --parallel=1 --failfast
  […]
  Testing against Django installed in '/home/lamby/git/debian/python-team/modules/python-django/django'
  Creating test database for alias 'default'...
  Creating test database for alias 'other'...
  System check identified no issues (14 silenced).
  .................sss..s............................sss..............................................................................................s..................................s..................................................s............................................................s................s.........................................................................................................................................................................................................................................s........................E
  ======================================================================
  ERROR: test_dumpdata_with_excludes (fixtures.tests.FixtureLoadingTests)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/utils.py"", line 85, in _execute
      return self.cursor.execute(sql, params)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/sqlite3/base.py"", line 296, in execute
      return Database.Cursor.execute(self, query, params)
  sqlite3.OperationalError: no such table: main.django_site__old
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File ""/home/lamby/git/debian/python-team/modules/python-django/tests/fixtures/tests.py"", line 330, in test_dumpdata_with_excludes
      Site.objects.all().delete()
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/models/query.py"", line 663, in delete
      deleted, _rows_count = collector.delete()
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/models/deletion.py"", line 282, in delete
      count = qs._raw_delete(using=self.using)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/models/query.py"", line 677, in _raw_delete
      return sql.DeleteQuery(self.model).delete_qs(self, using)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/models/sql/subqueries.py"", line 75, in delete_qs
      cursor = self.get_compiler(using).execute_sql(CURSOR)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/models/sql/compiler.py"", line 1065, in execute_sql
      cursor.execute(sql, params)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/utils.py"", line 68, in execute
      return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/utils.py"", line 77, in _execute_with_wrappers
      return executor(sql, params, many, context)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/utils.py"", line 85, in _execute
      return self.cursor.execute(sql, params)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/utils.py"", line 89, in __exit__
      raise dj_exc_value.with_traceback(traceback) from exc_value
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/utils.py"", line 85, in _execute
      return self.cursor.execute(sql, params)
    File ""/home/lamby/git/debian/python-team/modules/python-django/django/db/backends/sqlite3/base.py"", line 296, in execute
      return Database.Cursor.execute(self, query, params)
  django.db.utils.OperationalError: no such table: main.django_site__old
  
  ----------------------------------------------------------------------
  Ran 572 tests in 3.948s
  
  FAILED (errors=1, skipped=13)
}}}

Curiously, just running just this test does not result in a failure:

{{{
  $ cd tests
  $ PYTHONPATH=.. python3 ./runtests.py --parallel=1 --failfast fixtures.tests.FixtureLoadingTests.test_dumpdata_with_excludes
   Testing against Django installed in '/home/lamby/git/debian/python-team/modules/python-django/django'
  Creating test database for alias 'default'...
  Creating test database for alias 'other'...
  System check identified no issues (0 silenced).
  .
  ----------------------------------------------------------------------
  Ran 1 test in 0.020s
  
  OK
}}}

Two caveats:

 * This looks somewhat similar to https://code.djangoproject.com/ticket/29182 but that bug was opened some time ago so I am unsure at this point whether it is the same.

 * This may be a bug in `sqlite3` itself.

This was filed in Debian as https://bugs.debian.org/915626"	Bug	closed	Database layer (models, ORM)	2.1	Normal	duplicate	sqlite3 tests		Unreviewed	0	0	0	0	0	0
