Skip to content

Generated SQL is missing a space #2367

@madduck

Description

@madduck

Just noticed that there's an SQL failure when uploading a file and trying to update the FTS on PostgreSQL:

docspell-joex[103677]: 2023.11.10 15:44:37 [io-comp...] ERROR docspell.ftspsql.DoobieMeta - SQL Failure: ExecFailure(UPDATE ftspsql_search SET lang = ?, folder_id = ?, attach_name = ?, attach_content = ?, item_name = ?, item_notes = ?, fts_config = ?::regconfigWHERE id = ? ,List(German, None, None, None, Some(DB Ticket Weimar), None, german, Ident(item.9xAePRDDpfc-FjnS3gr3LEY-3Tp4KjZvYnZ-BgXMJFwdajj)),443032 nanoseconds,org.postgresql.util.PSQLException: ERROR: syntax error at or near "id" Position: 159)

There's a space missing in … fts_config = ?::regconfigWHERE id = ? ….

This seems to be generated here: https://github.com/eikek/docspell/blob/master/modules/fts-psql/src/main/scala/docspell/ftspsql/FtsRepository.scala#L144 and maybe just adding a space before WHERE would do the trick.

I am a bit confused though because the same problem exists 4 times in this file:

Happy to create the PR, but I have no idea what's going on as I don't understand Scala.

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