I do not know if this should be solved in the Date module or in Views, but since I did my "fix" in Views I thought I would start with posting this to Views.
The problem I am seeing is when using a Date field on a custom content-type.
The issue is a bit hard to explain, but I will try my best.
When I use Views to create a summary on the Date field value with contextual filters the resulting SQL will have the alias of the field with the same name as the column name for the field. So in the GROUP BY clause of the SQL query the value used for the alias will be equal to the column name which according to this thread is an undefined behavior. So the result is incorrect. See attached images. Correct is one list item with a count of 2.
My "fix" is not very handsome I think but it does the job for me (see attached patch). I doubt this is the way to go but I lack Views 3 knowledge to make a proper solution, if there is one.
We use a few more views for slideshows and things like that, that work fine with the patch applied. But the views are still very basic so this might affect other more complex views negatively.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | Column name matches alias with Date field-1163944-1.patch | 582 bytes | Michael Zetterberg fd. Lopez |
| correct.png | 7.59 KB | Michael Zetterberg fd. Lopez | |
| incorrect.png | 7.7 KB | Michael Zetterberg fd. Lopez |
Comments
Comment #1
Michael Zetterberg fd. Lopez commented...and the patch
Comment #2
dawehnerThis is probably a duplicate of #571548: Identifiers longer than 63 characters are truncated, causing Views to break on Postgres