Opened 13 months ago
Closed 13 months ago
#20628 closed defect (bug) (fixed)
Splitting the main query can result in long query strings that segfault
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Query | Version: | 3.4 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
When paging hierarchical post types, edit.php via wp_edit_posts_query() can create very long query strings that enumerate every post ID to fetch. If a limit is not present or very large, the query may beed to fallback to the old single query style.
See #20621
Attachments (3)
Change History (12)
Looks good. Should probably also pick an arbitrary limit like 500 at which point we no longer try to split the query.
+1 for 'split_the_query'.
Still need to check the limit if anyone cares to patch that.
I already see !empty( $limits ) in there, so what's left?
Oh, to not split the query if 'posts_per_page' => 500+? I don't know, that seems an unlikely edge case.
You usually either want paging (i.e a reasonable number), or you don't. Plus, it can be handled with 'split_the_query'.
Replying to scribu:
You usually either want paging (i.e a reasonable number), or you don't. Plus, it can be handled with 'split_the_query'.
While it *can* be handled with split the query, surely we've all seen posts_per_page = 99999 before — we should try to catch this by default.
How about we catch it earlier on, say in parse_query()?
if ( $q['posts_per_page'] >= 9999 ) $q['posts_per_page'] = -1;

split_the_query filter. Don't split if no limit.