timescaledb/test/sql/ddl_errors.sql
Erik Nordström 11938ebb08 Default to asking for number of partitions when partitioning column set.
Since create_hypertable() allows you to optionally specify a
partitioning column, it makes sense to default to one partition when
no column is specified and asking for the number of partitions when a
column is specified and the number of partitions is not (instead of
defaulting to one).

This patch also changes the order and type of partitioning-related
input arguments to create_hypertable() so that the number of
partitions can easily be specified alongside the partitioning column
and without type casting.
2017-03-06 20:26:02 +01:00

43 lines
1.2 KiB
SQL

\set ON_ERROR_STOP 1
\set VERBOSITY verbose
\set SHOW_CONTEXT never
\o /dev/null
\ir include/create_single_db.sql
\o
\set ECHO ALL
\c single
-- Expect error when adding user again
\set ON_ERROR_STOP 0
SELECT add_cluster_user();
\set ON_ERROR_STOP 1
-- 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);