Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1821,7 +1821,18 @@ |
1822 | 1822 | $tables[] = 'flaggedrevs'; |
1823 | 1823 | $fields[] = 'MAX(fr_quality) AS fr_quality'; |
1824 | 1824 | # Avoid duplicate rows due to multiple revs with the same sha-1 key |
1825 | | - $opts['GROUP BY'] = 'oi_name,oi_timestamp'; |
| 1825 | + |
| 1826 | + # This is a stupid hack to get all the field names in our GROUP BY |
| 1827 | + # clause. Postgres yells at you for not including all of the selected |
| 1828 | + # columns, so grab the full list, unset the two we actually want to |
| 1829 | + # order by, then append the rest of them to our two. It would be |
| 1830 | + # REALLY nice if we handled this automagically in makeSelectOptions() |
| 1831 | + # or something *sigh* |
| 1832 | + $groupBy = OldLocalFile::selectFields(); |
| 1833 | + unset( $groupBy[ array_search( 'oi_name', $groupBy ) ] ); |
| 1834 | + unset( $groupBy[ array_search( 'oi_timestamp', $groupBy ) ] ); |
| 1835 | + $opts['GROUP BY'] = 'oi_name,oi_timestamp,' . implode( ',', $groupBy ); |
| 1836 | + |
1826 | 1837 | $join_conds['flaggedrevs'] = array( 'LEFT JOIN', |
1827 | 1838 | 'oi_sha1 = fr_img_sha1 AND oi_timestamp = fr_img_timestamp' ); |
1828 | 1839 | } |