[Bug]: Malformed SQL Query - Invalid 'rrq' Prefix in SELECT Statement
Author: TealkCreated Aug 25, 2026Updated Sep 9, 2026
Labelsbug
Requirements
- Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
- Did you check to see if this issue already exists?
- Is this only a single bug? Do not put multiple bugs in one issue.
- Do you agree to follow the rules in our Code of Conduct?
- Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
PostgreSQL is rejecting a malformed SQL query with an invalid "rrq" prefix prepended to SELECT statements. The query rrqSELECT instance_id, last_successful_id FROM federation_queue_state LIMIT 5; fails with a syntax error. This appears to be a query builder or string concatenation bug in the federation queue state handling code.
Steps to Reproduce
- Set up a Lemmy instance with federation enabled
- Allow the instance to receive and process federated activities
- Wait for or trigger federation queue state queries to be executed
- Monitor PostgreSQL logs for SQL errors
- Observe the malformed query with "rrq" prefix appearing in logs
Technical Details
PostgreSQL Error Log:
2026-08-25 21:06:59.898 GMT [175] ERROR: syntax error at or near "rrqSELECT" at character 1
2026-08-25 21:06:59.898 GMT [175] STATEMENT: rrqSELECT instance_id, last_successful_id FROM federation_queue_state LIMIT 5;
OS: Alpine Linux (x86_64-pc-linux-musl) PostgreSQL Version: 16.14 Compiler: gcc 15.2.0
Version
0.19.20
Lemmy Instance URL
rollenspiel.forum
Source: LemmyNet/lemmy