ltss icon indicating copy to clipboard operation
ltss copied to clipboard

cannot start (update schema) - duplicate entity

Open jaakla opened this issue 10 months ago • 1 comments

It seems that with schema/version update ltss startup fails and no data is recorded anymore. The latest row in ltss table is 2023-07-26 22:20:31.732 +0300 , so it may be related to not most recent update, but something released back in July.

Error:

Logger: custom_components.ltss
Source: custom_components/ltss/__init__.py:133
Integration: ltss ([documentation](https://github.com/freol35241/ltss))
First occurred: 11:05:58 AM (1 occurrences)
Last logged: 11:05:58 AM

Error during connection setup: (psycopg2.errors.UniqueViolation) could not create unique index "18_2428_ltss_pkey" DETAIL: Key ("time", entity_id)=(2022-04-01 11:13:10.023225+00, sun.sun) is duplicated. CONTEXT: SQL statement " ALTER TABLE _timescaledb_internal._hyper_1_18_chunk ADD CONSTRAINT "18_2428_ltss_pkey" PRIMARY KEY ("time", entity_id) " PL/pgSQL function _timescaledb_internal.chunk_constraint_add_table_constraint(_timescaledb_catalog.chunk_constraint) line 29 at EXECUTE [SQL: ALTER TABLE ltss DROP CONSTRAINT ltss_pkey CASCADE, ADD PRIMARY KEY(time,entity_id);] (Background on this error at: https://sqlalche.me/e/20/gkpj) (retrying in 3 seconds)

jaakla avatar Oct 08 '23 08:10 jaakla