-
Notifications
You must be signed in to change notification settings - Fork 504
Open
Labels
domain::database 🗄️Key expertise in database is required, though the issue may also involve domain::core.Key expertise in database is required, though the issue may also involve domain::core.type::bug 🐛Issues that report undesirable or incorrect behavior.Issues that report undesirable or incorrect behavior.
Description
Describe the problem
Relates to Sentry issue 7258876168.
If a link_row field is PATCHed with an ID that overflows a 32-bit integer, the backend fails hard.
Steps to reproduce
- Add a
link_rowfield to your table PATCH /api/database/rows/table/{tableId}/{rowId}/?user_field_names=truewith data{"yourLinkRowField": [922469000000096100]
Actual result
The backend will fail hard:
File "/baserow/venv/lib/python3.11/site-packages/django/db/models/query.py", line 825, in bulk_create
returned_columns = self._batched_insert(
^^^^^^^^^^^^^^^^^^^^^
File "/baserow/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1901, in _batched_insert
self._insert(
File "/baserow/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1873, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/baserow/venv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1882, in execute_sql
cursor.execute(sql, params)
File "/baserow/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/baserow/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/baserow/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/baserow/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/baserow/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/baserow/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.DataError: integer out of range
Expected result
We already have string/name validation, we could do with row ID validation, because:
- Per this issue, a >32bit integer will overflow the column type
- If you send a smaller integer that you know doesn't map to a real row ID, we seem to just skip it (try and send
[999]or something).
Environment
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
domain::database 🗄️Key expertise in database is required, though the issue may also involve domain::core.Key expertise in database is required, though the issue may also involve domain::core.type::bug 🐛Issues that report undesirable or incorrect behavior.Issues that report undesirable or incorrect behavior.