﻿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
32935	Test suite fails with sqlite 3.36 and spatialite 5.	David Smith	nobody	"When looking at support for GDAL3.3 I was having issues getting the test suite to pass. The table below shows the scenarios I tried, I was able to get the suite to pass with spatialite 4.3 but unable to get it to pass with 5.0 until I dropped the sqlite version. 

||= Python =||= sqlite =|| spatialite || GDAL || GEOS || Proj || Tests ||
|| 3.8.10 || 3.36.0 || 4.3.0a || 3.1.2 || 3.8.1 || 7.1.0 || PASS ||
|| 3.9.6 || 3.36.0 || 5.0.1 || 3.2.0 || 3.8.1 || 7.1.1 || FAIL ||
|| 3.9.6 || 3.36.0 || 5.0.1 || 3.3.1 || 3.9.1 || 8.0.1 || FAIL ||
|| 3.8.10 || 3.36.0 || 5.0.1 || 3.3.0 || 3.9.1 || 8.0.1 || FAIL ||
|| 3.9.6 || 3.36.0 || 5.0.1 || 3.2.2 || 3.9.1 || 8.0.0 || FAIL ||
|| 3.8.10 || 3.36.0 || 5.0.1 || 3.2.2 || 3.9.1 || 8.0.0 || FAIL ||
|| 3.9.2 || 3.35.0 || 5.0.1 || 3.2.2 || 3.9.1 || 8.0.0 || PASS ||

The tests were failing not for a GIS test, but on databse setup. For exampe I had the same failure when runing the tests for `admin_inlines`. 

The tests fail when setting up the database with this error. 

{{{ 
File ""/workspaces/django/django/db/backends/sqlite3/base.py"", line 417, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: error in trigger ISO_metadata_reference_row_id_value_insert: no such column: rowid
}}}

At this point of failure `query` is `ALTER TABLE ""new__django_admin_log"" RENAME TO ""django_admin_log""` 

I found that if I changed this  [https://github.com/django/django/blame/a56531ab1b772ee4ae94dd805f168761887354c6/django/contrib/gis/db/backends/spatialite/base.py#L77 line] back to the same behaviour as spatialite 4x then the suite will pass.

I note that the [https://www.sqlite.org/draft/releaselog/current.html release notes] for sqlite 3.36 say the following, which I'm assuming is the cause of the issue here.  

> An error is raised on any attempt to access the rowid of a VIEW or subquery."	Bug	closed	GIS	4.2	Normal	needsinfo		Claude Paroz	Unreviewed	1	0	0	0	0	0
