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

[Bug]: "chunk_constraint" table constraint error when updating Timescale extension #6905

Closed
hongquan opened this issue May 10, 2024 · 1 comment · Fixed by #6911
Closed
Assignees
Labels

Comments

@hongquan
Copy link

hongquan commented May 10, 2024

What type of bug is this?

Configuration

What subsystems and features are affected?

Restore

What happened?

Today I upgaded TimescaleDB via apt (timescaledb-2-loader-postgresql-14 2.15.0~ubuntu22.04 package).

After that, I did in psql

$ psql mydb -Xc 'ALTER EXTENSION timescaledb UPDATE;'

and got this error:

INFO:  Removing metadata of chunk 1 from hypertable 1
ERROR:  update or delete on table "chunk" violates foreign key constraint "chunk_constraint_chunk_id_fkey" on table "chunk_constraint"
DETAIL:  Key (id)=(1) is still referenced from table "chunk_constraint".
CONTEXT:  SQL statement "DELETE FROM _timescaledb_catalog.chunk
    WHERE chunk.id = _chunk_id
    OR chunk.compressed_chunk_id = _chunk_id"
PL/pgSQL function _timescaledb_functions.remove_dropped_chunk_metadata(integer) line 46 at SQL statement

TimescaleDB version affected

2.15

PostgreSQL version used

14.11

What operating system did you use?

Ubuntu 22.04 x64

What installation method did you use?

Deb/Apt

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

No response

How can we reproduce the bug?

- Install old TimescaleDB from Packagecloud repository, on Ubuntu 22.04.
- `sudo apt upgrade`
- `psql mydb -Xc 'ALTER EXTENSION timescaledb UPDATE;'`
@hongquan hongquan added the bug label May 10, 2024
@svenklemm
Copy link
Member

On self-hosted you can manually delete the offending entries as a workaround.

DELETE FROM chunk_constraint WHERE chunk_id = 1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants