From 3f58f6adcde9ab5795f5b930b4fdb5a47c7ea862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Wed, 24 Jun 2026 18:37:48 +0400 Subject: [PATCH] =?UTF-8?q?v1.0.176:=20FOR=20UPDATE=20fix=20=E2=80=94=20OR?= =?UTF-8?q?DER=20BY=20LIMIT=201=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20M?= =?UTF-8?q?AX()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/db/spec_events.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/db/spec_events.py b/deploy/db/spec_events.py index b9e765a..e23081e 100644 --- a/deploy/db/spec_events.py +++ b/deploy/db/spec_events.py @@ -17,10 +17,11 @@ def get_next_seq(contract_id): conn.autocommit = False with conn.cursor() as cur: cur.execute( - "SELECT COALESCE(MAX(seq), 0) + 1 FROM spec_events WHERE contract_id = %s FOR UPDATE", + "SELECT seq FROM spec_events WHERE contract_id = %s ORDER BY seq DESC LIMIT 1 FOR UPDATE", (contract_id,), ) - seq = cur.fetchone()[0] + row = cur.fetchone() + seq = (row[0] + 1) if row else 1 conn.commit() return seq except Exception: