From c3b333af90a39f38559de59762c8c1e247ffa2a3 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Wed, 15 Oct 2025 21:40:42 -0300 Subject: fix a few postgres queries --- src/database_postgres.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/database_postgres.cc') diff --git a/src/database_postgres.cc b/src/database_postgres.cc index c79e921..8cfc6ab 100644 --- a/src/database_postgres.cc +++ b/src/database_postgres.cc @@ -1828,7 +1828,7 @@ bool GetCharacterProfile(TDatabase *Database, const char *CharacterName, TCharac " LEFT JOIN CharacterRights AS R" " ON R.CharacterID = C.CharacterID" " AND R.Name = 'NO_STATISTICS'" - " WHERE C.Name = $1::TEXT AND R.Right IS NULL"); + " WHERE C.Name = $1::TEXT AND R.Name IS NULL"); if(Stmt == NULL){ LOG_ERR("Failed to prepare query"); return false; @@ -3212,8 +3212,9 @@ bool MergeKillStatistics(TDatabase *Database, int WorldID, int NumStats, TKillSt const char *Stmt = PrepareQuery(Database, "INSERT INTO KillStatistics (WorldID, RaceName, TimesKilled, PlayersKilled)" " VALUES ($1::INTEGER, $2::TEXT, $3::INTEGER, $4::INTEGER)" - " ON CONFLICT DO UPDATE SET TimesKilled = TimesKilled + EXCLUDED.TimesKilled," - " PlayersKilled = PlayersKilled + EXCLUDED.PlayersKilled"); + " ON CONFLICT (WorldID, RaceName)" + " DO UPDATE SET TimesKilled = KillStatistics.TimesKilled + EXCLUDED.TimesKilled," + " PlayersKilled = KillStatistics.PlayersKilled + EXCLUDED.PlayersKilled"); if(Stmt == NULL){ LOG_ERR("Failed to prepare query"); return false; -- cgit v1.2.3