Updated: Comment #12
Problem/Motivation
I tried clicking on random things after running through the installation on Postgresql latest HEAD 2/10/2014. After I clicked Files tab under Content (admin/content/files), I found this error. It looks like there are multiple fid columns included in this query statement.
PDOException: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "fid" is ambiguous LINE 5: GROUP BY fid, file_managed_filename, file_managed_uri, file_... ^ in PDOStatement->execute() (line 61 of /Applications/MAMP/vhosts/drupal-git/core/lib/Drupal/Core/Database/Statement.php).
This prevents an administration user from using the admin/content/files interface. I have not tried the File Usage view display, but that may be unusable as well.
@merlinofchaos mentioned in a commit in 2009 that the base field should not have an alias.
Proposed resolution
Add the table.field syntax to the base field when it is added in a group by. This works because the base field does not have an alias per @merlinofchaos' comments above. There should not be any case of other fields that are just base field as field handlers should ensureTable() when adding fields or where clauses.
Can be manually tested by going to File Administration on Drupal 8 installation with PostgreSQL test bot or other install.
Remaining tasks
- Review
- Are we writing unit tests for Sql?
User interface changes
None.
API changes
None.
Original report by mradcliffe