Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This error appears when certain conditions are met:
- using the page empty text as default value for a missing argument (argdefault=7)
- SQL rewriting takes place (for example, when making use of the node access system)
When _view_build_query() encounters a missing argument, it returns an empty query "to trigger empty text". However, in views_build_view(), that empty query is then passed to db_rewrite_sql() without further checking. db_rewrite_sql() in turn doesn't check for empty queries, which leads to an incomplete query fragment being returned and queried afterwards, resulting in an error. The solution is to simply move the call to db_rewrite_sql() *after* the check for the non-empty query.
Comment | File | Size | Author |
---|---|---|---|
#6 | 247420-query.patch | 1.07 KB | agentrickard |
views.patch | 622 bytes | smk-ka | |
Comments
Comment #1
will_in_wi CreditAttribution: will_in_wi commentedI hit this same error and the patch fixed it.
Comment #2
sunThanks, committed.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
agentrickard@sun
Any chance you can roll a new 5.x.1.7 release with this in it? I keep having to re-apply the patch....
Comment #5
agentrickardI'm seeing this in 6.x.2.6 as well. Odd.
Comment #6
agentrickardChecked this in 6.x.2.8 as well.
This case can happen when a views pre_execute function nulls out the query. For example, when an exposed filter returns a null set. The same can happen with arguments.
This new patch was rolled against 6.x.2.6, but should be good for most versions.
Comment #7
dawehnerThis wil definitive needs a rerole for 3.x
I think views should fail somewhere when there is a empty query.
Comment #8
esmerel CreditAttribution: esmerel commentedif this needs a reroll for 3.x, should it get reassigned? I don't want to close something off that really does need doing.
Comment #9
Letharion CreditAttribution: Letharion commentedComment #10
dawehnerA somehow similar patch was already commited to 6.x-3.x