From 01b50e33f7e555d652b9eecea2caf33877a5e154 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 20 May 2021 20:48:56 +0100 Subject: [PATCH] Fix resolve_group() if the version number is greater than 65535 Signed-off-by: Graham --- .../resources/org/openrs2/archive/migrations/V1__init.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archive/src/main/resources/org/openrs2/archive/migrations/V1__init.sql b/archive/src/main/resources/org/openrs2/archive/migrations/V1__init.sql index 4c82aa2b..6cb75ff8 100644 --- a/archive/src/main/resources/org/openrs2/archive/migrations/V1__init.sql +++ b/archive/src/main/resources/org/openrs2/archive/migrations/V1__init.sql @@ -179,7 +179,10 @@ CREATE FUNCTION resolve_group(_archive_id uint1, _group_id INTEGER, _crc32 INTEG SELECT c.* FROM groups g JOIN containers c ON c.id = g.container_id - WHERE g.archive_id = _archive_id AND g.group_id = _group_id AND c.crc32 = _crc32 AND g.version = _version & 65535 + WHERE g.archive_id = _archive_id AND g.group_id = _group_id AND c.crc32 = _crc32 AND ( + (g.version = _version AND NOT g.version_truncated) OR + (g.version = _version & 65535 AND g.version_truncated) + ) ORDER BY g.version_truncated ASC, c.id ASC LIMIT 1; $$ LANGUAGE SQL STABLE PARALLEL SAFE ROWS 1;