-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
when I tried to create tsdb table with name longer than 58 symbols I've got an exception:
...........
File "/venv/lib/python3.12/site-packages/pgtrigger/migrations.py", line 420, in create_model
super().create_model(model)
File "/venv/lib/python3.12/site-packages/timescale/db/backends/postgresql/schema.py", line 131, in create_model
self._create_hypertable(model, field)
File "/venv/lib/python3.12/site-packages/timescale/db/backends/postgresql/schema.py", line 95, in _create_hypertable
self._drop_primary_key(model)
File "/venv/lib/python3.12/site-packages/timescale/db/backends/postgresql/schema.py", line 85, in _drop_primary_key
self.execute(sql)
File "/venv/lib/python3.12/site-packages/pgtrigger/migrations.py", line 404, in execute
return super().execute(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
return super().execute(sql, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/django/db/backends/base/schema.py", line 202, in execute
cursor.execute(sql, params)
File "/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.12/site-packages/django/db/backends/utils.py", line 103, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.12/site-packages/psycopg/cursor.py", line 737, in execute
raise ex.with_traceback(None)
django.db.utils.ProgrammingError: constraint "slm_metrics_optimizer_foo_123456789_123456789_123456789_123c369" of relation "slm_metrics_optimizer_foo_123456789_123456789_123456789_123c369" does not exist
it's happened due to table/field/constraint name length limitation (63 bytes), and actual pkey name in that case is slm_metrics_optimizer_foo_123456789_123456789_123456789_12_pkey
| pkey = self.quote_name(f'{db_table}_pkey') |
Metadata
Metadata
Assignees
Labels
No labels