DBLab enables 🖖 database branching and ⚡️ thin cloning for any Postgres database and empowers DB testing in CI/CD. This optimizes database-related costs while improving time-to-market and software quality. Follow to stay updated.
When cloning using the restricted user template (e.g. Joe Bot) and Timescaledb hypertables, the clone fails:
High level logs:
ERROR: failed to create a Database Lab clone: failed to create a new clone: failed to create clone, unexpected status given: FATAL
Explanation from server logs:
FATAL failed to run objects restrict query: pq: operation not supported on chunk tables
The reason is because the restricted script tries to change the owner of all relations to the restricted user, which is not allowed for timescaledb chunks.
How to replicate the error:
1) Set up a DB Lab instance with a snapshot that includes TimescaleDB tables. The clone container must also support TimescaleDB (Postgres.AI extended already does)
2) Clone the snapshot with restricted mode active, or with a standard install of Joe Bot
Problem:
When cloning using the restricted user template (e.g. Joe Bot) and Timescaledb hypertables, the clone fails:
High level logs: ERROR: failed to create a Database Lab clone: failed to create a new clone: failed to create clone, unexpected status given: FATAL
Explanation from server logs: FATAL failed to run objects restrict query: pq: operation not supported on chunk tables
The reason is because the restricted script tries to change the owner of all relations to the restricted user, which is not allowed for timescaledb chunks.
How to replicate the error:
1) Set up a DB Lab instance with a snapshot that includes TimescaleDB tables. The clone container must also support TimescaleDB (Postgres.AI extended already does) 2) Clone the snapshot with restricted mode active, or with a standard install of Joe Bot
Proposed solution:
Edit database-lab-engine/engine/internal/provision/databases/postgres/postgres_mgmt.go
Change
and not n.nspname in ('pg_catalog', 'information_schema')
toand not n.nspname in ('pg_catalog', 'information_schema', '_timescaledb_internal')