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.
I'm getting a "SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)" error with my date filter that can be fixed by rolling back a change to the date_views module. A patch is attached.
Comment | File | Size | Author |
---|---|---|---|
#9 | date-n2596097-9.patch | 2.12 KB | steinmb |
Comments
Comment #2
akosipax CreditAttribution: akosipax commentedHere's another patch that is relative the date module's directory and would apply cleanly.
Comment #3
estebanhere CreditAttribution: estebanhere commentedI'm getting a "SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 2 column(s)" error, when I try to use a relationship representative node in a view.
Why? I use the patch, but it does not work for me
Thanks!
Comment #4
DamienMcKennaThe problem is that the query generator returns a value like this:
(for September 1st, 2016)
AND (DATE_FORMAT(FROM_UNIXTIME(field_data_field_something.field_something_value), '%Y-%m-%d') >= '2016', '9', '1')
If you execute the DATE_FORMAT() string on its own it results in string like this: 2016-08-12
Clearly the problem is that something is converting the date to an array and then they're being output as three comma separated strings instead of being combined into a date value.
Comment #5
DamienMcKennaSo while #2420323: Exposed date filter shouldn't automatically set a default date if none requested fixed empty default values it broke handling of non-empty default values. OTOH the previous code didn't work either ;-)
Comment #6
DamienMcKennaI feel like this is going in circles :-\
Comment #7
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 2 year old patch in #6 to date_views_filter_handler_simple.inc does not apply to the latest 7.x-2.x-dev and may be too old to easily reroll, but I went ahead and tagged the issue accordingly.
Comment #8
DamienMcKennaI think we need test coverage too.
Comment #9
steinmb CreditAttribution: steinmb as a volunteer commentedUntested, manual re-roll.