Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-12 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"5d95a1c35ef1375a7badcb217c36c5974d1e57ee" 5d95a1c]:
 {{{#!CommitTicketReference repository=""
 revision="5d95a1c35ef1375a7badcb217c36c5974d1e57ee"
 [5.0.x] Refs #35194 -- Adjusted a generated field test to work on Postgres
 15.6+.

 Postgres >= 12.18, 13.14, 14.11, 15.6, 16.2 changed the way the
 immutability
 of generated and default expressions is detected in
 postgres/postgres@743ddaf.

 The adjusted test semantic is presereved by switching from __icontains to
 __contains as both make use of a `%` literal which requires proper
 escaping.

 Refs #35336.

 Thanks bcail for the report.

 Backport of 73b62a21265c4a417004d64d13a896469e2558f3 from main.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ed265d787-3335be85-617a-46ce-b820-16e8b883abc4-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-12 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"73b62a21265c4a417004d64d13a896469e2558f3" 73b62a21]:
 {{{#!CommitTicketReference repository=""
 revision="73b62a21265c4a417004d64d13a896469e2558f3"
 Refs #35194 -- Adjusted a generated field test to work on Postgres 15.6+.

 Postgres >= 12.18, 13.14, 14.11, 15.6, 16.2 changed the way the
 immutability
 of generated and default expressions is detected in
 postgres/postgres@743ddaf.

 The adjusted test semantic is presereved by switching from __icontains to
 __contains as both make use of a `%` literal which requires proper
 escaping.

 Refs #35336.

 Thanks bcail for the report.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ed16743c4-e8052341-2e91-4e2f-8f85-0da94204f26d-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-05 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by GitHub ):

 In [changeset:"d859c0be9c6098f624429874b695017c97ecf125" d859c0b]:
 {{{#!CommitTicketReference repository=""
 revision="d859c0be9c6098f624429874b695017c97ecf125"
 [5.0.x] Refs #35336 -- Fixed
 SchemaTests.test_add_generated_field_contains() test on PostgreSQL.

 Concat() in Django 5.0 is not immutable on PostgreSQL and cannot be used
 in GeneratedField, see 6364b6ee1071381eb3a23ba6b821fc0d6f0fce75.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018eae2eb782-46b61fe5-aab2-4f20-b802-eab1acff5de9-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-04 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Adrian Garcia):

 Woohoo, thanks again everyone for all the effort. You managed to have
 5.0.4 released before my PR was merged lol.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018eaa37aa41-c246e76e-8124-4fe6-ad57-e81f52488633-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Natalia Bidart):

 Adrian, the release is planned for tomorrow. Thank you for your help!
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ea08d4ef7-17ee42f7-84f2-419a-96db-a0efea94bb6b-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Ready for
  generatedfield, contains   |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * stage:  Accepted => Ready for checkin

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ea0888396-11b590f4-cf16-4ef2-80d0-7d5643b27708-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Natalia <124304+nessita@…>):

 In [changeset:"fead2dd52303505f30007df5e3c198b48b3ce9ae" fead2dd]:
 {{{#!CommitTicketReference repository=""
 revision="fead2dd52303505f30007df5e3c198b48b3ce9ae"
 [5.0.x] Fixed #35336 -- Addressed crash when adding a GeneratedField with
 % literals.

 A longer term solution is likely to have a better separation of
 parametrized
 DDL altogether to handle checks, constraints, defaults, and generated
 fields
 but such a change would require a significant refactor that isn't suitable
 for a backport.

 Thanks Adrian Garcia for the report.

 Backport of 888b9042b3598bab6557c62de82505eec9ea62ed from main
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ea085bfd2-8cca19d2-737e-4ee3-b068-22d7dbd85e1c-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by GitHub ):

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

Comment:

 In [changeset:"888b9042b3598bab6557c62de82505eec9ea62ed" 888b9042]:
 {{{#!CommitTicketReference repository=""
 revision="888b9042b3598bab6557c62de82505eec9ea62ed"
 Fixed #35336 -- Addressed crash when adding a GeneratedField with %
 literals.

 A longer term solution is likely to have a better separation of
 parametrized
 DDL altogether to handle checks, constraints, defaults, and generated
 fields
 but such a change would require a significant refactor that isn't suitable
 for a backport.

 Thanks Adrian Garcia for the report.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ea0846e55-a58b93bc-67f0-4159-ba6f-7eac714892e4-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Simon Charette):

 > are there plans for a more unified SQL translator in a future release

 I think the many regressions we've run into in the past releases in
 escaping DDL (the subset of SQL for defining objects) in the schema editor
 (the component behind migrations) warrants spending time having a less
 convoluted approach.

 I think that we should experiment with having backends denote whether or
 not they support parametrized DDL (the ability to call
 `Cursor.execute(ddl: str, params: tuple)` over having the schema editor do
 the `%` formatting itself), make sure all parts of the scheme editor
 return `(str, tuple)` and never simply `str`, and then adjust
 `SchemaEditor.execute` to do `cursor.execute(ddl, params)` when
 `connection.features.support_parametrized_dll` and do `cursor.execute(ddl
 % map(self.quote_value, params), None)` otherwise.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e9f8105d6-641eed1b-7078-4aba-9793-ee74590b4484-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-04-02 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Adrian Garcia):

 Thanks for the rundown, it really helped me understand what was going on
 when I followed the execution with a debugger. The ORM is easily my
 favorite part of Django and it's no surprise that it is complicated as
 hell, are there plans for a more unified SQL translator in a future
 release? I'd be interested in following the progress of that.

 I tested the fix and it works great, might not even need to use the
 workaround if 5.0.4 gets released in the next few weeks. Thanks for the
 speedy patch.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e9f16c044-45fa7c91-c151-44fb-91f6-10db7bdaa0f5-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-03-31 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * needs_better_patch:  1 => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e958ed2d4-6c6869e2-09e1-4dc6-b10c-bdb44860e4a4-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-03-28 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * has_patch:  0 => 1
 * needs_better_patch:  0 => 1

Comment:

 > Out of curiosity, why does this issue only present itself when adding a
 field? Does Django handle SQL generation differently for table creation vs
 field addition?

 I'm still laying down the details
 [https://github.com/django/django/pull/18027 in this MR] but the short
 answer is yes.

 The DBAPI `Cursor.execute` method can be used in two ways when dealing
 with parameters. Either `(sql: str, params: [])` which will delegate
 parametrization to the library or `(sql: str, params: None)` which won't
 attempt to parametrize the SQL. This is an important difference and
 requires special care when dealing with `%` literals in parameters as it's
 the symbol use for parametrization placeholders by most libraries.

 Well some backend simply don't support parametrization in some DDL
 statements such as `GENERATED` columns declaration, in other words you
 can't do

 {{{#!python
 cursor.execute(
 "ALTER TABLE invoice ADD COLUMN discount_display text GENERATED ALWAYS
 discount || %s;",
 ["%"]
 )
 }}}

 So you must do

 {{{#!python
 cursor.execute(
 "ALTER TABLE invoice ADD COLUMN discount_display text GENERATED ALWAYS
 AS discount || '%';", None
 )
 }}}

 Well in the case of `SchemaEditor.create_model` we liberally do one or the
 other and in your case, because you don't have any other field with a
 `db_default` assuming your use Postgres, it does the right thing.

 In the case of `SchemaEditor.add_field` however we always do `params:
 list`, which forces parametrization, and thus

 {{{#!python
 cursor.execute(
 "ALTER TABLE testmodel ADD COLUMN contains_heck text GENERATED ALWAYS
 AS UPPER(description) LIKE '%HECK%';", []
 )
 }}}

 Crashes as there is an attempt to interpolate the two `%` while `params`
 is empty.

 The schema migration has historically use parametrizable DDL in the past
 when possible but this has become increasingly complex as more and more
 features were added (indexes, constraints, `db_default`, `GeneratedField`)
 to a point where I don't think we can continue doing so but the tricky
 part is that we can't make such a change in a bug fix release without
 risking to introduce further problems. This is made even worst by the fact
 that objects as `Index` and `Constraint` subclasses return already
 interpolated SQL (their `as_sql` methods return `"CHECK UPPER(description)
 LIKE '%HECK%'"` instead of `("CHECK UPPER(description) LIKE %s",
 "%HECK%")` so even if we wanted to use it entirely to the backend until
 the last minute by using `quote_value` ourselves we can't as by that point
 we have a mixture of interpolated and non-interpolated SQL.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e85bd49fd-1ec7c223-0d2b-42a0-b93a-b156e26d2245-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-03-28 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Adrian Garcia):

 Thanks for looking into this, I'm glad to know that it's a bug and not me
 doing something incorrectly. I'll use `iregex` as a workaround until
 5.0.4.

 Out of curiosity, why does this issue only present itself when adding a
 field? Does Django handle SQL generation differently for table creation vs
 field addition?
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e855bb148-a86a2fd7-3d28-4690-b685-e139d3fa77cd-00%40eu-central-1.amazonses.com.


Re: [Django] #35336: Adding GeneratedField fails with ProgrammingError when using When on CharField

2024-03-27 Thread Django
#35336: Adding GeneratedField fails with ProgrammingError when using When on
CharField
-+-
 Reporter:  Adrian Garcia|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  postgres,| Triage Stage:  Accepted
  generatedfield, contains   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * component:  Migrations => Database layer (models, ORM)
 * keywords:  postgres, generatedfield, _split_query => postgres,
 generatedfield, contains
 * owner:  nobody => Simon Charette
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted
 * status:  new => assigned

Comment:

 This can be reproduced on `psycopg2` and `psycopg>=3` and is reminiscent
 of the series of issues we had to fix with `Constraint`'s usage of
 `__contains` lookup which require proper `%` escaping (#30408, #34553,
 #32369)

 {{{#!diff
 diff --git a/tests/schema/tests.py b/tests/schema/tests.py
 index f8e314d270..3b2d7bf03c 100644
 --- a/tests/schema/tests.py
 +++ b/tests/schema/tests.py
 @@ -886,6 +886,27 @@ class Meta:
  with connection.schema_editor() as editor:
  editor.create_model(GeneratedFieldOutputFieldModel)

 +@isolate_apps("schema")
 +@skipUnlessDBFeature("supports_stored_generated_columns")
 +def test_add_generated_field_contains(self):
 +class GeneratedFieldContainsModel(Model):
 +text = TextField()
 +
 +class Meta:
 +app_label = "schema"
 +
 +field = GeneratedField(
 +expression=Q(text__icontains="FOO"),
 +db_persist=True,
 +output_field=BooleanField(),
 +)
 +field.contribute_to_class(GeneratedFieldContainsModel,
 "some_field")
 +
 +with connection.schema_editor() as editor:
 +editor.create_model(GeneratedFieldContainsModel)
 +editor.add_field(GeneratedFieldContainsModel, field)
 +
 +
  @isolate_apps("schema")
  def test_add_auto_field(self):
  class AddAutoFieldModel(Model):
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e834d2bbe-6e75c9da-3384-48e6-9244-f60b5908204b-00%40eu-central-1.amazonses.com.