Fix _sql_constraints validation when there is duplicated id in list for

issue1198
This commit is contained in:
Cédric Krier committed 2009-09-30 14:42:00 +02:00
1 parent fbde24da78
commit cadc9c40f0
1 file changed
+3 -4
+3 -4
View File
@@ -2160,13 +2160,12 @@ class ModelSQL(ModelStorage):
'FROM "' + self._table + '" ' \
'WHERE ' + red_sql, red_ids)
fetchall = cursor.fetchall()
cursor.execute('SELECT id ' \
'FROM "' + self._table + '" ' \
'WHERE ' + \
' OR '.join((sql_clause,) * len(sub_ids)),
reduce(lambda x, y: x + list(y),
cursor.fetchall(),
[]))
' OR '.join((sql_clause,) * len(fetchall)),
reduce(lambda x, y: x + list(y), fetchall, []))
if cursor.fetchone():
self.raise_user_error(cursor, error, context=context)