Describe the bug
When using the search field on the Markers page, any input will result in an error due to a missing SQL JOIN to the scenes table.
To Reproduce
Steps to reproduce the behavior:
Go to Markers
Click on the search field
Enter anything
See error:
error executing count query with SQL: SELECT COUNT(*) as count FROM (SELECT DISTINCT scene_markers.id FROM scene_markers LEFT JOIN tags ON scene_markers.primary_tag_id = tags.id WHERE (scene_markers.title LIKE ? OR scenes.title LIKE ? OR tags.name LIKE ?)) as temp, args: [%text% %text% %text%], error: error executing `SELECT COUNT(*) as count FROM (SELECT DISTINCT scene_markers.id FROM scene_markers LEFT JOIN tags ON scene_markers.primary_tag_id = tags.id WHERE (scene_markers.title LIKE ? OR scenes.title LIKE ? OR tags.name LIKE ?)) as temp` [[%text% %text% %text%]]: no such column: scenes.title
Expected behavior
The correct SQL query would be:
SELECT COUNT(*) AS count
FROM
(SELECT DISTINCT scene_markers.id
FROM scene_markers
LEFT JOIN tags
ON scene_markers.primary_tag_id = tags.id
LEFT JOIN scenes
ON scene_markers.scene_id = scenes.id
WHERE (scene_markers.title LIKE '%text%'
OR scenes.title LIKE '%text%'
OR tags.name LIKE '%text%')) AS temp
However the JOIN to the scenes table is missing which means this is the query being executed:
SELECT COUNT(*) AS count
FROM
(SELECT DISTINCT scene_markers.id
FROM scene_markers
LEFT JOIN tags
ON scene_markers.primary_tag_id = tags.id
WHERE (scene_markers.title LIKE '%text%'
OR scenes.title LIKE '%text%'
OR tags.name LIKE '%text%')) AS temp
Describe the bug When using the search field on the Markers page, any input will result in an error due to a missing SQL
JOIN
to thescenes
table.To Reproduce Steps to reproduce the behavior:
Expected behavior The correct SQL query would be:
However the
JOIN
to thescenes
table is missing which means this is the query being executed:So the
scenes.title
column would be missing.Stash Version: (from Settings -> About): v0.26.1-24-ga8fca47a
Additional context @DogmaDragon confirmed the error.