Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple_* methods handle None incorrectly for key values #14157

Open
matrixbot opened this issue Dec 20, 2023 · 0 comments
Open

simple_* methods handle None incorrectly for key values #14157

matrixbot opened this issue Dec 20, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 20, 2023

This issue has been migrated from #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).
@matrixbot matrixbot changed the title Dummy issue simple_* methods handle None incorrectly for key values Dec 21, 2023
@matrixbot matrixbot reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant