[Django] #31902: Fail on SQL generation for ExclusionConstraint with complex expression

5 views
Skip to first unread message

Django

unread,
Aug 18, 2020, 10:21:07 PM8/18/20
to django-...@googlegroups.com
#31902: Fail on SQL generation for ExclusionConstraint with complex expression
-------------------------------------+-------------------------------------
Reporter: Maxim | Owner: (none)
Petrov |
Type: Bug | Status: new
Component: | Version: master
contrib.postgres |
Severity: Normal | Keywords: ExclusionConstraint
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
When expression for ExclusionConstraint is complex with some parameters
Django fails to generate SQL because of wrong params substitution.

{{{
ExclusionConstraint(
name='field_left',
expressions=[(Left('field', 4), RangeOperators.EQUAL)],
)
}}}

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

Django

unread,
Aug 18, 2020, 10:21:42 PM8/18/20
to django-...@googlegroups.com
#31902: Fail on SQL generation for ExclusionConstraint with complex expression
-------------------------------------+-------------------------------------
Reporter: Maxim Petrov | Owner: Maxim
| Petrov
Type: Bug | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: ExclusionConstraint | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Maxim Petrov):

* owner: (none) => Maxim Petrov
* status: new => assigned


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

Django

unread,
Aug 18, 2020, 10:33:21 PM8/18/20
to django-...@googlegroups.com
#31902: Fail on SQL generation for ExclusionConstraint with complex expression
-------------------------------------+-------------------------------------
Reporter: Maxim Petrov | Owner: Maxim
| Petrov
Type: Bug | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: ExclusionConstraint | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Maxim Petrov):

* stage: Unreviewed => Accepted


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

Django

unread,
Aug 19, 2020, 12:13:59 AM8/19/20
to django-...@googlegroups.com
#31902: Fail on SQL generation for ExclusionConstraint with complex expression
-------------------------------------+-------------------------------------
Reporter: Maxim Petrov | Owner: Maxim
| Petrov
Type: Bug | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: ExclusionConstraint | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Unreviewed


Comment:

You shouldn't accept your own tickets.

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

Django

unread,
Aug 19, 2020, 12:26:38 AM8/19/20
to django-...@googlegroups.com
#31902: ExclusionConstraint crashes on expression with params.

-------------------------------------+-------------------------------------
Reporter: Maxim Petrov | Owner: Maxim
| Petrov
Type: Bug | Status: assigned
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: ExclusionConstraint | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* stage: Unreviewed => Accepted


Comment:

Thanks for the report.

Reproduced at d534b5734f5087cb0b9a20bd7cd28bfda93c71b0.

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

Django

unread,
Aug 19, 2020, 1:34:24 AM8/19/20
to django-...@googlegroups.com
#31902: ExclusionConstraint crashes on expression with params.
-------------------------------------+-------------------------------------
Reporter: Maxim Petrov | Owner: Maxim
| Petrov
Type: Bug | Status: closed
Component: contrib.postgres | Version: master
Severity: Normal | Resolution: fixed

Keywords: ExclusionConstraint | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

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


Comment:

In [changeset:"bf6d07730c41ae23836d8dae98626fe8614307e2" bf6d077]:
{{{
#!CommitTicketReference repository=""
revision="bf6d07730c41ae23836d8dae98626fe8614307e2"
Fixed #31902 -- Fixed crash of ExclusionConstraint on expressions with
params.
}}}

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

Reply all
Reply to author
Forward
0 new messages