This is a followup to http://drupal.org/node/621142
DISTINCT is not a valid option for many query types. It is really very much part of the query settings, so we should move it.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 882800.distinct_empty_check.patch | 1.21 KB | rszrama |
| #4 | 882800-4-distinct-query_settings.patch | 6.07 KB | becw |
| #1 | 882800-distinct-query_settings.patch | 5.73 KB | dawehner |
Comments
Comment #1
dawehnerHere is a patch.
It convertes the distinct option, if set. I tested the patch quite intensive.
What about groupby? I don't know any contrib/custom backend which supports the option at the moment.
Comment #2
bojanz commentedApplies, seems to work (did a quick test).
I agree that groupby should be handled the same (move it to query options), it's an sql thing, so it makes sense.
Doesn't need to happen in this issue though.
Comment #3
merlinofchaos commentedCommitted to D6. Didn't apply to D7.
Comment #4
becw commentedThe patch applies to 7.x-3.x with fuzz; I re-rolled it and am attaching a version that applies cleanly. It moves the setting, but using 'distinct' still yields an error, since evidently new work is needed to support distinct queries on D7:
Exception: d7cx: Column-level distinct is not supported yet. in views_plugin_query_default->compile_fields() (line 940 of /shared/vash/sandboxes/white/barnard/site/www/sites/all/modules/views/plugins/views_plugin_query_default.inc).Comment #5
dawehnerSee #863478: Distinct is not supported by dbtng
It still seems not to be supported? I'm confused a bit, and asked berdir.
Comment #6
dawehnerCommited the patch with a commented out distinct option. Let's fix this later.
Comment #7
rszrama commentedI'm not sure, but I think the commented out distinct option is why I'm getting undefined index errors on every View for this bit o' code:
Perhaps the if statement should have been commented out, too?
(Sorry, I don't know enough about how Views uses issue tags to tell if the alpha-4 blocker status is for 2.x or 3.x issues, so I'm leaving it alone for now.)
Comment #8
dawehnerI think here should be used !empty
Comment #9
rszrama commentedAlrighty, added an empty().
Comment #10
dawehnerThanks.
Comment #12
asb commentedFollow-up issue: #1234048: Distinct requires workaround with bad usability to make 6.x-3.x-dev work like Views 2