[Django] #33379: Add minimum database version checks

12 views
Skip to first unread message

Django

unread,
Dec 20, 2021, 7:25:57 PM12/20/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: nobody
Graham |
Type: New | Status: new
feature |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
7444f3252757ed4384623e5afd7dcfeef3e0c74e added a minimum version check for
SQLite, but the other database backends don't have such a check. We
sometimes get bug reports from people using an unsupported database
version, so I think the checks would add value. Is a query to fetch the
database version on startup an acceptable cost?

Perhaps there's a better way to run a query just once, but here's what I
did in django-cockroachdb:
https://github.com/cockroachdb/django-
cockroachdb/commit/27ebbefa515edf3ba68a5373dea48c4acdda60ab

We could make the check generic by adding
`DatabaseFeatures.minimum_database_version` as well as a standard method
to get the database version as suggested in #18332.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 21, 2021, 12:07:01 AM12/21/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Unreviewed => Accepted


Comment:

Makes sense, thanks. IMO an extra query on startup is acceptable.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:1>

Django

unread,
Dec 21, 2021, 8:22:14 AM12/21/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

Through a system check?

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:2>

Django

unread,
Dec 21, 2021, 8:37:03 AM12/21/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Jacob Walls):

Nick proposed a minimum check for MySQL in ticket:18392#comment:49.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:3>

Django

unread,
Dec 27, 2021, 1:28:51 PM12/27/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: nobody => Hasan Ramezani
* status: new => assigned
* has_patch: 0 => 1


Comment:

I've created a [https://github.com/django/django/pull/15244 draft patch]
and implemented the check for the SQLite backend.
@Tim, please check it and let me know if the implementation and if you are
ok I can continue with the other backends.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:4>

Django

unread,
Dec 28, 2021, 3:43:49 AM12/28/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:5>

Django

unread,
Dec 30, 2021, 4:50:11 PM12/30/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


Comment:

[https://github.com/django/django/pull/15244 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:6>

Django

unread,
Dec 31, 2021, 12:48:47 AM12/31/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:7>

Django

unread,
Dec 31, 2021, 7:08:21 AM12/31/21
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:8>

Django

unread,
Jan 10, 2022, 6:54:33 PM1/10/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


Comment:

As noted on the PR, I tested this with CockroachDB and it doesn't work
because the system check framework runs after other initialization
queries, some of which fail on older versions of CockroachDB. Perhaps
moving the error to another method like
DatabaseWrapper.init_connection_state() as I did for CockroachDB
(implementation linked in ticket description) is more suitable.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:9>

Django

unread,
Jan 11, 2022, 7:41:39 AM1/11/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


Comment:

I've added a new commit to the existing patch and moved the database
version check to `init_connection_state`.
Also, I've changed the tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:10>

Django

unread,
Jan 28, 2022, 12:24:31 AM1/28/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:11>

Django

unread,
Jan 30, 2022, 1:28:22 PM1/30/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:12>

Django

unread,
Feb 17, 2022, 6:38:08 PM2/17/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:13>

Django

unread,
Feb 18, 2022, 2:55:27 PM2/18/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: closed

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9ac3ef59f9538cfb520e3607af743532434d1755" 9ac3ef59]:
{{{
#!CommitTicketReference repository=""
revision="9ac3ef59f9538cfb520e3607af743532434d1755"
Fixed #33379 -- Added minimum database version checks.

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:14>

Django

unread,
May 17, 2022, 9:00:10 AM5/17/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton@…>):

In [changeset:"2cec020f5bc462954d902bdad1a5955852cecff6" 2cec020f]:
{{{
#!CommitTicketReference repository=""
revision="2cec020f5bc462954d902bdad1a5955852cecff6"
Refs #33379 -- Fixed minimum supported version of MariaDB.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:15>

Django

unread,
May 17, 2022, 9:01:05 AM5/17/22
to django-...@googlegroups.com
#33379: Add minimum database version checks
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Hasan
| Ramezani
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"fad2e59808fe276864a090f1adb7ad88e61cc22c" fad2e598]:
{{{
#!CommitTicketReference repository=""
revision="fad2e59808fe276864a090f1adb7ad88e61cc22c"
[4.1.x] Refs #33379 -- Fixed minimum supported version of MariaDB.

Backport of 2cec020f5bc462954d902bdad1a5955852cecff6 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33379#comment:16>

Reply all
Reply to author
Forward
0 new messages