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.

Comments

david_garcia’s picture

Status: Active » Needs review
StatusFileSize
new1.21 KB

See original issue for details.

Status: Needs review » Needs work

The last submitted patch, 1: d8-2159347-no-constants-in-aggregate.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: d8-2159347-no-constants-in-aggregate.patch, failed testing.

Status: Needs work » Needs review
david_garcia’s picture

Retested, I cannot see why the failure is related in anyway to the changes in the database layer.

Status: Needs review » Needs work

The last submitted patch, 1: d8-2159347-no-constants-in-aggregate.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: d8-2159347-no-constants-in-aggregate.patch, failed testing.

david_garcia’s picture

This 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.

dawehner’s picture

Issue tags: +Needs tests
daffie’s picture

Version: 8.1.x-dev » 8.0.x-dev

Code changes that are necessary for specific database have to move to the database driver.

daffie’s picture

Component: views.module » database system

Moving it to the database system.

joelpittet’s picture

Issue tags: +oracle, +SQL Server, +PostgreSQL

Tagging so this can be found.

dawehner’s picture

I 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

david_garcia’s picture

Component: database system » views.module
Issue summary: View changes

Updated issue summary + moved back to views.module as I think this is not really an issue of the database abstraction layer.

david_garcia’s picture

Status: Needs work » Needs review

Retest to get a meaningful detail of the failure.

Status: Needs review » Needs work

The last submitted patch, 1: d8-2159347-no-constants-in-aggregate.patch, failed testing.

david_garcia’s picture

StatusFileSize
new1.25 KB
david_garcia’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 21: d8-2159347-no-constants-in-aggregate.patch, failed testing.

kfitz’s picture

Issue summary: View changes

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

cilefen’s picture

Can someone create a failing test?

xjm’s picture

Priority: Major » Normal

Since 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.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

roderik’s picture

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

acbramley’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative, +Needs steps to reproduce, +Needs issue summary update

This came up in BSI triage today.

We need an update to the issue summary including steps to reproduce.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since 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!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.