diff --git a/src/main/java/com/hm/achievement/db/PooledRequestsSender.java b/src/main/java/com/hm/achievement/db/PooledRequestsSender.java index f0c8b80b6..ee111cf10 100644 --- a/src/main/java/com/hm/achievement/db/PooledRequestsSender.java +++ b/src/main/java/com/hm/achievement/db/PooledRequestsSender.java @@ -141,8 +141,8 @@ private void batchRequestsForMultipleCategory(Statement st, MultipleAchievements if (plugin.getDatabaseManager().getDatabaseType() == DatabaseType.POSTGRESQL) { st.addBatch("INSERT INTO " + plugin.getDatabaseManager().getTablePrefix() + category.toDBName() + " VALUES ('" + entry.getKey().substring(0, 36) + "', '" + entry.getKey().substring(36) + "', " - + entry.getValue() + ") ON CONFLICT (playername, '" + category.toSubcategoryDBName() - + "') DO UPDATE SET (" + category.toDBName() + ")=(" + entry.getValue() + ")"); + + entry.getValue() + ") ON CONFLICT (playername, " + category.toSubcategoryDBName() + + ") DO UPDATE SET (" + category.toDBName() + ")=(" + entry.getValue() + ")"); } else { st.addBatch("REPLACE INTO " + plugin.getDatabaseManager().getTablePrefix() + category.toDBName() + " VALUES ('" + entry.getKey().substring(0, 36) + "', '" + entry.getKey().substring(36) + "', " diff --git a/src/main/java/com/hm/achievement/db/SQLDatabaseManager.java b/src/main/java/com/hm/achievement/db/SQLDatabaseManager.java index 2375f9376..01091adee 100644 --- a/src/main/java/com/hm/achievement/db/SQLDatabaseManager.java +++ b/src/main/java/com/hm/achievement/db/SQLDatabaseManager.java @@ -682,8 +682,8 @@ protected void performWrite() throws SQLException { // PostgreSQL has no REPLACE operator. We have to use the INSERT ... ON CONFLICT construct, // which is available for PostgreSQL 9.5+. query = "INSERT INTO " + tablePrefix + category.toDBName() + " VALUES ('" + player.toString() - + "', ?, " + statistic + ")" + " ON CONFLICT (playername, '" + subcategory - + "') DO UPDATE SET (" + category.toDBName() + ")=('" + statistic + "')"; + + "', ?, " + statistic + ")" + " ON CONFLICT (playername, " + category.toSubcategoryDBName() + + ") DO UPDATE SET (" + category.toDBName() + ")=('" + statistic + "')"; } else { query = "REPLACE INTO " + tablePrefix + category.toDBName() + " VALUES ('" + player.toString() + "', ?, " + statistic + ")";