Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-02-07 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  Hisham
 |  Mahmood
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (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 Alan):

 Thank you, Hisham Mahmood and Mariusz, for picking this up.

 Sorry for leaving this hanging. I got overwhelmed on my main job, so
 wasn't able to find a spare hour for this.
-- 
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/0107018d84b28f4b-7c8ff0c7-fe3f-432d-bc0d-ff9a449a01ca-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-02-07 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  Hisham
 |  Mahmood
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (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 ):

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

Comment:

 In [changeset:"d79fba7d8e7bbcdf53535a14d57ead5a6863cd8d" d79fba7d]:
 {{{#!CommitTicketReference repository=""
 revision="d79fba7d8e7bbcdf53535a14d57ead5a6863cd8d"
 Fixed #35099 -- Prevented mutating queryset when combining with & and |
 operators.

 Thanks Alan for the report.

 Co-authored-by: Mariusz Felisiak 
 }}}
-- 
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/0107018d83810b07-021ad042-f825-429e-bf1a-d965887b4691-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-02-07 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  Hisham
 |  Mahmood
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (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 Mariusz Felisiak):

 * owner:  Alan => Hisham Mahmood
 * has_patch:  0 => 1
 * stage:  Accepted => Ready for checkin

Comment:

 [https://github.com/django/django/pull/17829 PR]
-- 
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/0107018d83045ed8-de59cac1-c6b5-4022-bff2-b878e5c4eb38-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-01-10 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  Alan
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (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):

 * owner:  nobody => Alan
 * status:  new => assigned


-- 
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/0107018cf2f1fe3f-12e90748-2a95-4686-ab6f-ed5dad6fe60a-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-01-10 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (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 Mariusz Felisiak):

 > Regarding the patch, I've never contributed to Django, so it may take
 quite a while for me to get familiar with what's required. If you could
 point me to the key resources on how to do that, I may take a shot on a
 weekend.

 Great, thanks! I'd recommend joining our [https://discord.gg/xcRH6mN4fa
 Discord server] and asking on the `#contributing-getting-started` channel,
 folks are very helpful there.

-- 
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/0107018cf2c20014-3b93890a-184b-4324-906e-36d46162007b-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side.

2024-01-10 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (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 Alan):

 Replying to [comment:2 Mariusz Felisiak]:
 > Does it work for you? Would you like to prepare a patch? (a regression
 test is required).

 It does work for me, the test now passes correctly after applying cloning
 the rhs.

 Regarding the patch, I've never contributed to Django, so it may take
 quite a while for me to get familiar with what's required. If you could
 point me to the key resources on how to do that, I may take a shot on a
 weekend.

 I found a "Submitting a patches" in Django doc. I need more guidance on
 how to cover this case with regression tests. I would highly appreciate
 some references to take a look at.

-- 
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/0107018cf2bbb607-e028afbe-77ea-48f8-bb38-d92fe0521ee4-00%40eu-central-1.amazonses.com.


Re: [Django] #35099: Combining QuerySets with "|" or "&" mutates right-hand side. (was: Combining QuerySets with "|" or "&" produce side effects affecting further queries)

2024-01-10 Thread Django
#35099: Combining QuerySets with "|" or "&" mutates right-hand side.
-+-
 Reporter:  Alan |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (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:

 Thanks for the report.This is caused by
 
[https://github.com/django/django/blob/9b02ad91ead3db75036be981bab2083aebc993a6/django/db/models/sql/query.py#L688
 bumping prefixes], we should probably clone `rhs` before doing this, e.g.
 {{{#!diff
 diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
 index a79d66eb21..5539f35b1c 100644
 --- a/django/db/models/sql/query.py
 +++ b/django/db/models/sql/query.py
 @@ -685,6 +685,7 @@ class Query(BaseExpression):
  # except if the alias is the base table since it must be present
 in the
  # query on both sides.
  initial_alias = self.get_initial_alias()
 +rhs = rhs.clone()
  rhs.bump_prefix(self, exclude={initial_alias})

  # Work out how to relabel the rhs aliases, if necessary.
 }}}
 Does it work for you? Would you like to prepare a patch? (a regression
 test is required).

-- 
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/0107018cf28767ae-e23ab235-aafa-4716-92ff-2636d1d193fa-00%40eu-central-1.amazonses.com.