Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] SQL Error After Deleting Item #3835

Closed
Flashy78 opened this issue Jun 16, 2023 · 2 comments · Fixed by #3845
Closed

[Bug Report] SQL Error After Deleting Item #3835

Flashy78 opened this issue Jun 16, 2023 · 2 comments · Fixed by #3845
Labels
bug Something isn't working

Comments

@Flashy78
Copy link
Contributor

If you create a studio or tag and then delete it, a subsequent call is made to FindScenes and passing in the just deleted id.
This fails with:

failed to get hierarchical values: error executing
`WITH RECURSIVE items AS ( SELECT id as root_id, id as item_id, 0 as depth FROM studios WHERE id in (?)
UNION SELECT p.root_id, c.id, depth + 1 FROM studios as c INNER JOIN items as p ON c.parent_id = p.item_id )
SELECT 'VALUES' || GROUP_CONCAT('(' || root_id || ', ' || item_id || ')') AS val FROM items\`
[[27]]: sql: Scan error on column index 0, name "val": converting NULL to string is unsupported

Sometimes it shows up in the log and sometimes it doesn't, maybe related to the page navigation after a deletion. Commenting out the navigation causes the error to always be displayed in the UI.
https://github.com/stashapp/stash/blob/develop/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx#L136

Confirmed in v.21 and latest develop.

@Flashy78 Flashy78 added the bug report Bug reports that are not yet verified label Jun 16, 2023
@WithoutPants WithoutPants added this to the Version 0.22.0 milestone Jun 17, 2023
@DogmaDragon
Copy link
Collaborator

DogmaDragon commented Jun 17, 2023

Reproduced on 9180a68.

@DogmaDragon DogmaDragon added bug Something isn't working and removed bug report Bug reports that are not yet verified labels Jun 17, 2023
@DingDongSoLong4
Copy link
Collaborator

This only happens when the scene tab is selected, because studio mutations and tag mutations only invalidate the findScenes query, which is arguably incorrect behaviour. Mutating a tag or a studio will impact the results of all find... queries which can have a tag or studio as a filter argument.

It also only happens when "Display subtag/sub-studios content" is enabled, or if you manually change the filter on the studio/tag page to include subsidiary studios/tags.

When you do this query

{
  findScenes(scene_filter: {
    studios: {value: 0, modifier: INCLUDES}
  }) {
    count
  }
}

it simply returns count 0, but this query

{
  findScenes(scene_filter: {
    studios: {value: 0, modifier: INCLUDES, depth: -1}
  }) {
    count
  }
}

returns the hierarchical error. This, in my opinion, is the issue - filtering for an invalid studio should just return nothing instead of an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants