element-hq / element-hq/synapse
simple_* methods handle `None` incorrectly for key values
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#14157](https://github.com/matrix-org/synapse/issues/14157).
---
Generally the `simple_*` methods do not handle `None` properly when used as a key-value (the exact arguments differ by method). See #14138 for real fallout from this.
`simple_upsert_emulated_txn` has special handling for `null` which should likely be abstracted:
https://github.com/matrix-org/synapse/blob/b4ec4f5e71a87d5bdc840a4220dfd9a34c54c847/synapse/storage/database.py#L1304-L1310
This is mostly a footgun that we could avoid by either:
1. Raising an exception (or asserting) when a key-value is `None`.
2. Automatically handling `None` and turning it into `IS NONE` (which is what `simple_upsert_emulated_txn` does).
Contributor guide
Assessment
This issue has not been assessed yet.