From f8de1d23c650e87f6d46b9da117efc38bb329f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Mon, 14 Aug 2023 21:26:59 +0200 Subject: [PATCH] Replace NEXTVAL call by IDENTITY for database initialisation --- trytond/trytond/backend/postgresql/database.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trytond/trytond/backend/postgresql/database.py b/trytond/trytond/backend/postgresql/database.py index 525612141c..6de28b714f 100644 --- a/trytond/trytond/backend/postgresql/database.py +++ b/trytond/trytond/backend/postgresql/database.py @@ -362,12 +362,12 @@ class Database(DatabaseInterface): if module in ('ir', 'res'): state = 'to activate' info = get_module_info(module) - cursor.execute('SELECT NEXTVAL(\'ir_module_id_seq\')') - module_id = cursor.fetchone()[0] cursor.execute('INSERT INTO ir_module ' - '(id, create_uid, create_date, name, state) ' - 'VALUES (%s, %s, now(), %s, %s)', - (module_id, 0, module, state)) + '(create_uid, create_date, name, state) ' + 'VALUES (%s, now(), %s, %s) ' + 'RETURNING id', + (0, module, state)) + module_id = cursor.fetchone()[0] for dependency in info.get('depends', []): cursor.execute('INSERT INTO ir_module_dependency ' '(create_uid, create_date, module, name) '