• Aaron Wells's avatar
    Refactoring SQL query in View::shared_to_user() (Bug 1476495) · 462b1c47
    Aaron Wells authored
    The old one unnecessarily used two separate queries for Postgres
    & MySQL. And it had a bug in how it used MySQL's extended
    "GROUP BY" functionality. While MySQL does let you return
    non-aggregated columns, it uses an arbitrary record for these of
    them, NOT the first record according to ORDER BY.
    
    Also restructured the query a bit for optimization purposes.
    
    behatnotneeded (Test in subsequent patch)
    
    Change-Id: I3d49292025dcf7ac510a84d7e800476defec0525
    462b1c47