-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[BUG] Syntax error when query relation size in PostgreSQL, seems like missing comma #4380
Description
Describe the bug
I recently upgraded to PostgreSQL 14 backend (Update: This issue also applies to PostgreSQL 12 backend). When I access FreshRSS's "Manage users" configuration page, FreshRSS will automatically send a query
SELECT
pg_total_relation_size('"username_category"')
pg_total_relation_size('"username_feed"')
pg_total_relation_size('"username_entry"')
pg_total_relation_size('"username_entrytmp"')
pg_total_relation_size('"username_tag"')
pg_total_relation_size('"username_entrytag"')
to the database to retrieve database sizes. However, this SQL statement seems to contain syntax errors.
From PostgreSQL 14's log output:
2022-05-19 09:59:39.366 UTC [220] ERROR: syntax error at or near "(" at character 76
2022-05-19 09:59:39.366 UTC [220] STATEMENT: SELECT
pg_total_relation_size('"username_category"')
pg_total_relation_size('"username_feed"')
...
near "(" at character 76 indicates the second "(". Seems like there are missing "+" operators between the PostgreSQL functions.
To Reproduce
Steps to reproduce the behavior:
- Deploy and Initialize FreshRSS with a PostgreSQL 14 database using Docker
- Log in to FreshRSS WebUI as an administrator
- Navigate to Settings - Manage users
- Monitor the log of the PostgreSQL 14.3 database
Expected behavior
A successful SQL query returns the size of relations.
Screenshots
The failed SQL query results in zero "Database size":

Environment information (please complete the following information):
- Device: N.A.
- OS: Debian 11.3
- Browser: Firefox 100
- FreshRSS version: 1.19.2
- Database version: PostgreSQL 14.3 ( official PostgreSQL docker image library/postgres:14 )
- PHP version: PHP 7.4.25 (in freshrss/freshrss official Docker image)
- Installation type: Docker ( freshrss/freshrss )
Additional context
Related code (DatabaseDAOPGSQL) seems to be here:
FreshRSS/app/Models/DatabaseDAOPGSQL.php
Lines 61 to 68 in 5eaefe0
| SELECT | |
| pg_total_relation_size('`{$this->pdo->prefix()}category`') + | |
| pg_total_relation_size('`{$this->pdo->prefix()}feed`') + | |
| pg_total_relation_size('`{$this->pdo->prefix()}entry`') + | |
| pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') + | |
| pg_total_relation_size('`{$this->pdo->prefix()}tag`') + | |
| pg_total_relation_size('`{$this->pdo->prefix()}entrytag`') | |
| SQL; |
but I don't know why the "+" are missing in the database's log.