mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-21 05:04:32 +08:00
Clean up the table schema to get rid of legacy tables and functionality that makes it more difficult to provide an upgrade path. Notable changes: * Get rid of legacy tables and code * Simplify directory structure for SQL code * Simplify table hierarchy: remove root table and make chunk tables * inherit directly from main table * Change chunk table suffix from _data to _chunk * Simplify schema usage: _timescaledb_internal for internal functions. * _timescaledb_catalog for metadata tables. * Remove postgres_fdw dependency * Improve code comments in sql code
31 lines
1.0 KiB
SQL
31 lines
1.0 KiB
SQL
\o /dev/null
|
|
\ir include/create_single_db.sql
|
|
\o
|
|
|
|
-- Expect error when adding node again
|
|
|
|
CREATE TABLE PUBLIC."Hypertable_1" (
|
|
time BIGINT NOT NULL,
|
|
"Device_id" TEXT NOT NULL,
|
|
temp_c int NOT NULL DEFAULT -1
|
|
);
|
|
CREATE INDEX ON PUBLIC."Hypertable_1" (time, "Device_id");
|
|
|
|
\set ON_ERROR_STOP 0
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1_mispelled"', 'time', 'Device_id', 2);
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time_mispelled', 'Device_id', 2);
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'Device_id', 'Device_id', 2);
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id_mispelled', 2);
|
|
|
|
INSERT INTO PUBLIC."Hypertable_1" VALUES(1,'dev_1', 3);
|
|
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|
|
|
|
DELETE FROM PUBLIC."Hypertable_1" ;
|
|
\set ON_ERROR_STOP 1
|
|
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|
|
|
|
\set ON_ERROR_STOP 0
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|