summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/persistence.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index c4a9402fb..81024c41f 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -494,12 +494,12 @@ def _collect_update_commands(
params[col.key] = history.added[0]
else:
pk_params[col._label] = history.unchanged[0]
+ if pk_params[col._label] is None:
+ raise orm_exc.FlushError(
+ "Can't update table %s using NULL for primary "
+ "key value on column %s" % (table, col))
if params or value_params:
- if None in pk_params.values():
- raise orm_exc.FlushError(
- "Can't update table using NULL for primary "
- "key value")
params.update(pk_params)
yield (
state, state_dict, params, mapper,