Skip to content

Restricted template cloning failure when using timescaledb [simple fix included] #173

@TheLiamGuy

Description

@TheLiamGuy

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') to and not n.nspname in ('pg_catalog', 'information_schema', '_timescaledb_internal')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions