mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #4689] [Bug]: Node traffic sync fails with PostgreSQL — function max(bigint, unknown) does not exist #3239
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3239
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SergioSHA1 on GitHub (May 30, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4689
Describe the bug
When using the Nodes feature with a PostgreSQL backend, node traffic sync fails every 5 seconds with the error:
WARNING - node traffic sync: merge for user failed: ERROR: function max(bigint, unknown) does not exist (SQLSTATE 42883)
How to reproduce the problem
Install 3x-ui with PostgreSQL backend (XUI_DB_TYPE=postgres)
Add a remote node via Nodes → Add Node
Enable the node
Check journalctl -u x-ui -f — the error appears every 5 seconds
Expected behavior
Node traffic should sync correctly without SQL errors.
Actual behavior
Traffic sync fails. PostgreSQL does not have a scalar max(bigint, unknown) function — only an aggregate max(bigint). The SQL generated by 3x-ui is incompatible with PostgreSQL.
Traffic sync fails every 5 seconds. PostgreSQL does not have a scalar max(bigint, unknown) function — only an aggregate max(bigint). The SQL generated by 3x-ui is incompatible with PostgreSQL.
Temporary workaround (tested on PostgreSQL 14):
```sql
CREATE OR REPLACE FUNCTION max(bigint, bigint)
RETURNS bigint AS
SELECT GREATEST($1, $2);
LANGUAGE SQL IMMUTABLE STRICT;```
After creating this function and restarting x-ui, the error disappears and node traffic sync works correctly.
Relevant logs
Screenshots
No response
3x-ui version
3.2.0
Xray-core version
26.5.9
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 22.04
Which parts of the panel are affected?
Statistics / traffic counters, Multi-node (sub-nodes)
Browser (only if it is a UI bug)
N/A (not a UI bug)
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@ariashamshiri commented on GitHub (May 31, 2026):
Please fix.
@Leonid-Perkin commented on GitHub (Jun 5, 2026):
in version 3.2.8, the error returned again.
X-UI: node traffic sync: merge forrufailed:ERROR: CASE types boolean and integer cannot be matched (SQLSTATE 42804)