Problem/Motivation
Follow up from #2159347: Aggregation not working simple test case
Views is generating under some circumstances queries that have constant expressions inside the aggregation clause.
This, besides making no sense as constant values have no effect on aggregates, makes these queries incompatible with SQL Server and Oracle (probably Postgre too, but have not tested).
This is a query with a literal in aggregate:
SELECT uid FROM users GROUP BY 'literal', uid
This is without it:
SELECT uid FROM uers GROUP BY uid
Steps to reproduce
--
Proposed resolution
Skip constant values and expressions when generating the aggregation part of the query.
Remaining tasks
Review
RTBC
Commit
User interface changes
None.
API changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | d8-2159347-no-constants-in-aggregate.patch | 1.25 KB | david_garcia |
| #1 | d8-2159347-no-constants-in-aggregate.patch | 1.21 KB | david_garcia |
Comments
Comment #1
david_garcia commentedSee original issue for details.
Comment #6
david_garcia commentedRetested, I cannot see why the failure is related in anyway to the changes in the database layer.
Comment #10
david_garcia commentedComment #11
david_garcia commentedThis could be sorted out at a database driver level by expanding the constant expression into a cross join, but still this is an issue that needs to be solved.
Comment #12
dawehnerComment #13
daffie commentedCode changes that are necessary for specific database have to move to the database driver.
Comment #14
daffie commentedMoving it to the database system.
Comment #15
joelpittetTagging so this can be found.
Comment #16
dawehnerI give an excrement about oracle or SQL server, it would be great though to fix pgsql.
Can we please update the issue summary with examples of actual queries before and after for example?
Its not trivial to see what is going on on this issue
Comment #17
david_garcia commentedUpdated issue summary + moved back to views.module as I think this is not really an issue of the database abstraction layer.
Comment #18
david_garcia commentedRetest to get a meaningful detail of the failure.
Comment #21
david_garcia commentedComment #22
david_garcia commentedComment #24
kfitz commentedComment #27
cilefen commentedCan someone create a failing test?
Comment #28
xjmSince for the most part Views is actually working on postgres, @dawehner, @tim.plunkett, @alexpott, @cilefen, and I agreed that this is a normal bug if anything. If anyone has steps to create a view through the UI that is broken on postgres because of this bug, please document steps to reproduce it and re-promote the issue to major.
I agree that a failing test is the next step here.
Comment #35
roderikComment #41
acbramley commentedThis came up in BSI triage today.
We need an update to the issue summary including steps to reproduce.
Comment #42
smustgrave commentedSince there's been no follow up with steps to reproduce I'm closing out. If still a bug please re-open updating the summary with steps.
Thanks all!