https://github.com/tbicr/django-pg-zero-downtime-migrations/ uses `ALTER
TABLE %(table)s VALIDATE CONSTRAINT` to restrict how long the table is
locked for writing. I was contemplating to touch this subject in the
patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/29824>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> A lot of work was done to add the check constraint to Django 2.2. On top
> of such a constraint, PostgreSQL has an exclusion constraint that works
> well on ranges, regardless if they're represented using two fields, or a
> single field using a range-type. Essentially, this constraint enforces a
> unique constraint for ranges, with a possibility for an additional check.
>
> https://github.com/tbicr/django-pg-zero-downtime-migrations/ uses `ALTER
> TABLE %(table)s VALIDATE CONSTRAINT` to restrict how long the table is
> locked for writing. I was contemplating to touch this subject in the
> patch.
New description:
A lot of work was done to add the check constraint to Django 2.2. On top
of such a constraint, PostgreSQL has an exclusion constraint that works
well on ranges, regardless if they're represented using two fields, or a
single field using a range-type. Essentially, this constraint enforces a
unique constraint for ranges, with a possibility for an additional check.
https://github.com/tbicr/django-pg-zero-downtime-migrations/ uses `ALTER
TABLE %(table)s VALIDATE CONSTRAINT` to restrict how long the table is
locked for writing. I was contemplating to touch this subject in the
patch.
[https://github.com/django/django/pull/10478 PR]
--
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:1>
* needs_better_patch: 0 => 1
* version: 2.1 => master
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:3>
* needs_better_patch: 1 => 0
Comment:
I believe the PR is now in a state where it merits a review. I'm not sure
if the tests should also include the model with two fields, or if it's
sufficient that it's discussed in the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:4>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:6>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a3417282ac0464a9a2d1d7685bcfef10feed2597" a3417282]:
{{{
#!CommitTicketReference repository=""
revision="a3417282ac0464a9a2d1d7685bcfef10feed2597"
Fixed #29824 -- Added support for database exclusion constraints on
PostgreSQL.
Thanks to Nick Pope and Mariusz Felisiak for review.
Co-Authored-By: Mariusz Felisiak <felisiak...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:9>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"7174cf0b009711c41e5f76f6c0c68137898716a0" 7174cf0]:
{{{
#!CommitTicketReference repository=""
revision="7174cf0b009711c41e5f76f6c0c68137898716a0"
Refs #29824 -- Added RangeOperators helper class.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29824#comment:8>