From eeb19b72404e9d578a4e09d9ba1afbb4a1e552db Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sat, 6 Jun 2026 01:46:55 +0200 Subject: [PATCH] fix(node-sync): merge client enable with boolean AND for PostgreSQL The per-client traffic merge built enable = CASE WHEN ? = 0 THEN 0 ELSE enable END, mixing an integer literal with the boolean enable column. PostgreSQL rejects this with SQLSTATE 42804, aborting every node traffic merge transaction every 5s and freezing all up/down/last_online accounting on Postgres main panels. Replace with enable AND ?, which is type-safe on Postgres (boolean AND boolean) and identical in semantics on SQLite: the node may only disable a client, never re-enable one the panel already disabled. Closes #4964 --- web/service/inbound.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/service/inbound.go b/web/service/inbound.go index 33995368..670c370a 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -1760,7 +1760,7 @@ func (s *InboundService) setRemoteTrafficLocked(nodeID int, snap *runtime.Traffi // from the node arriving after a central disable would otherwise // overwrite enable=false back to true, letting the client accumulate // far more traffic than their limit before being disabled again. - enableExpr := "CASE WHEN ? = 0 THEN 0 ELSE enable END" + enableExpr := "enable AND ?" if err := tx.Exec( fmt.Sprintf( `UPDATE client_traffics