Skip to content

500 Internal Server Error on trying to retrieve items using the query attach.count>2 #1758

@jalwn

Description

@jalwn

I'm trying to query for attachments using the item search endpoint sec/item/search
I am able to retrieve items using the query attach.id=attachment_id_value
however attach.count gives a 500 internal server error attach.count>2
whenever I query, a warning is logged for the postgres container.
Its the same for both GET and POST request

2022-09-25 08:47:10.625 UTC [12077] ERROR:  missing FROM-clause entry for table "cta" at character 976
2022-09-25 08:47:10.625 UTC [12077] STATEMENT:  SELECT i.itemid, i.name, i.state, COALESCE(i.itemdate, i.created) , i.duedate, i.source, i.incoming, i.created, o.oid, o.name, pers0.pid, pers0.name, pers1.pid, pers1.name, e.eid, e.name, f.id, f.name, SUBSTRING(i.notes FROM $1 FOR $2) , $3 , i.created FROM item i LEFT JOIN folder f ON (f.id = i.folder_id AND f.cid = $4 ) LEFT JOIN person pers0 ON (pers0.pid = i.corrperson AND pers0.cid = $5 ) LEFT JOIN organization o ON (o.oid = i.corrorg AND o.cid = $6 ) LEFT JOIN person pers1 ON (pers1.pid = i.concperson AND pers1.cid = $7 ) LEFT JOIN equipment e ON (e.eid = i.concequipment AND e.cid = $8 ) WHERE (i.cid = $9  AND i.state IN ($10 , $11 ) AND (i.folder_id is null  OR i.folder_id IN (SELECT f.id FROM folder f INNER JOIN user_ u ON f.owner = u.uid WHERE (f.cid = $12  AND u.login = $13 ) UNION ALL SELECT m.folder_id FROM folder_member m INNER JOIN folder f ON f.id = m.folder_id INNER JOIN user_ u ON u.uid = m.user_id WHERE (f.cid = $14  AND u.login = $15 ))) AND cta.num > $16 ) ORDER BY COALESCE(i.itemdate, i.created)  DESC  LIMIT $17

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working or in unexpected waysrestserverAffects the rest server.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions