•  
      request #5711 Naming a field "id" breaks the report
    Infos
    #5711
    Yoann Celton (jtekt)
    2022-06-13 12:01
    2013-12-09 18:27
    5823
    Details
    Naming a field "id" breaks the report

    If you name a field "ID" and try to display it in the report, the something is messed up and the report is empty. 

    Logs shows the query is invalid (not saying why). This is the said query: 

    SELECT a.id AS id,
           c.id AS changeset_id ,
           R2_25262.value AS `name`,
           a.per_tracker_artifact_id AS `id`,
           R2_25311.user_id AS `name_1`
    FROM tracker_artifact AS a
    INNER JOIN tracker_changeset AS c ON (c.artifact_id = a.id)
    LEFT JOIN (tracker_changeset_value AS R1_25262
               INNER JOIN tracker_changeset_value_text AS R2_25262 ON (R2_25262.changeset_value_id = R1_25262.id) ) ON (R1_25262.changeset_id = c.id
                                                                                                                        AND R1_25262.field_id = 25262)
    LEFT JOIN (tracker_changeset_value AS R1_25311
               INNER JOIN tracker_changeset_value_list AS R3_25311 ON (R3_25311.changeset_value_id = R1_25311.id)
               LEFT JOIN USER AS R2_25311 ON (R2_25311.user_id = R3_25311.bindvalue_id) ) ON (R1_25311.changeset_id = c.id
                                                                                              AND R1_25311.field_id = 25311)
    WHERE a.id IN (5473)
      AND c.id IN (25957)
    GROUP BY id

    Running it by hand gives a `ambiguous column name 'id'` error. Replacing the last line by "Group by c.id" solves the issue. For now we change the name of the ID field and everything works again.

    Trackers
    All
    CentOS 5 + php51
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Closed
    2022-06-13
    Attachments
    Empty
    References
    Referenced by request #5711

    Follow-ups

    User avatar
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    • Status changed from Under review to Verified
    User avatar

    A fix is under review: http://gerrit.tuleap.net/#/c/1555/


    • Status changed from Acknowledged to Under review
    User avatar
    dylan bowden (dylan)2013-12-10 08:42
    Hi,
    there are two issues here; one is not checking the field name; the other is the query. I have traced the query back to Tracker_Report_Renderer_Table (line 1086). Looking at the code, I think it should be grouped by a.id.

    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    • Status changed from New to Acknowledged