From 00f81cf62fea387806833dd33379a4b20a49ebf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Tue, 5 Mar 2024 16:08:19 +0100 Subject: [PATCH] Limit search for NULL rows when adding a NOT NULL constraint --- trytond/trytond/backend/postgresql/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/trytond/backend/postgresql/table.py b/trytond/trytond/backend/postgresql/table.py index 2a677f606c..1f68327e22 100644 --- a/trytond/trytond/backend/postgresql/table.py +++ b/trytond/trytond/backend/postgresql/table.py @@ -440,7 +440,7 @@ class TableHandler(TableHandlerInterface): if self._columns[column_name]['notnull']: return cursor.execute(SQL( - 'SELECT id FROM {} WHERE {} IS NULL').format( + 'SELECT id FROM {} WHERE {} IS NULL LIMIT 1').format( Identifier(self.table_name), Identifier(column_name))) if not cursor.rowcount: