New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes/sqlite3 too many sql variables #6749
Fixes/sqlite3 too many sql variables #6749
Conversation
Additional explanation: For SQLite, the Django ORM creates SQL using a |
@@ -188,32 +188,38 @@ def get_page_actions_for_user(user, site): | |||
) | |||
nodes = [page.node for page in pages] | |||
pages_by_id = {} | |||
page_permissions_chunks = [] | |||
|
|||
for offset in range(0, pages.count(), 500): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make this number more explicit by setting a constant (something like PAGE_PERMISSION_CHUNK_SIZE)
We can then have different numbers for different database backends and make it very large (to the point of being infinite) for DBMS other than sqlite
@FinalAngel , @yakky Proposal: a) I make this number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrief do you think we can have a test to replicate this behavior? It will probably be very slow (due to the huge number of pages needed) and thus it might be needed to be marked with some skipIf
to only run in a subset of the travis matrix
I honestly don't think this is the way to go, for being a limitation of sqlite only, worst-case scenario I would add a condition that avoids this issue only for sqlite. |
@yakky puh, writing a test for this scenario would indeed require to add a lot of pages to the tree. I'm not sure if this is worthwhile.
This is perfectly fine, but that number shall not be configurable through the owners
That's simple. We can use a variable instead of
I looked at this, but since the queryset which could be used for the subquery, is modified by calling some Django permission functions, I don't believe it's feasible. Shall I modify that pull request and use a meaningful variable name instead of 500 and apply that only to SQLite? |
@jrief
Subqueries would be great, and the |
@jrief would this be useful in develop for 3.9.0 ? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This will now be closed due to inactivity, but feel free to reopen it. |
Summary
Fixes #6746
Ported from #6748 for django-CMS 3.7
Proposed changes in this pull request
Fixes the bug.
General checklist
if necessary