Unable to create distributed hypertable on Multi-node TimescaleDB setup

577 Views Asked by At

I am trying to create a distributed hypertable on a multi-node setup of timescaledb. I can easily create the table and then convert it to a distributed hypertable using the "create_distributed_hypertable" command. This works on the "public" schema but if I create the table on my own created schema, the regular postgresql table gets created but the conversion does not work and I get the following error:

ERROR:  [multinode-timescaledb-data-1]: schema "myschema" does not exist
SQL state: 3F000

SQL for regular table:

CREATE TABLE myschema.stocks_intraday (
"time" timestamp NOT NULL,
symbol text NULL,
price_open double precision NULL,
price_close double precision NULL,
price_low double precision NULL,
price_high double precision NULL,
trading_volume int NULL
);

SQL for conversion:

SELECT create_distributed_hypertable('myschema.stocks_intraday', 'time');
1

There are 1 best solutions below

0
On

The error happens on data node multinode-timescaledb-data-1, since, I guess, you haven't created myschema on the data node.

TimescaleDB doesn't take care of creating schemas on data nodes, when creating hypertable there.

You need to create your schema on each data node either by login to each data node or by using distributed_exec:

CALL distributed_exec($$ CREATE SCHEMA myschema $$);