timescaledb/test/sql/alternate_users.sql
Matvey Arye e20edf890c Add better error checking for index creation.
This PR adds more regression tests for index creation and tests for more
user-errors. Significantly, it checks for the presence of both the time
and spaced-partition columns in unique indexes. This is needed because
Timescale cannot guarantee uniqueness if colliding rows don't land in the
same chunk. Fixes #29.
2017-05-03 13:21:32 -04:00

30 lines
645 B
SQL

\ir include/insert_single.sql
DO $$
BEGIN
CREATE ROLE alt_usr LOGIN;
EXCEPTION
WHEN duplicate_object THEN
--mute error
END$$;
CREATE SCHEMA IF NOT EXISTS "customSchema" AUTHORIZATION alt_usr;
\c single alt_usr
\dt
\set ON_ERROR_STOP 0
SELECT * FROM "one_Partition";
\set ON_ERROR_STOP 1
CREATE TABLE "1dim"(time timestamp, temp float);
SELECT create_hypertable('"1dim"', 'time');
INSERT INTO "1dim" VALUES('2017-01-20T09:00:01', 22.5);
INSERT INTO "1dim" VALUES('2017-01-20T09:00:21', 21.2);
INSERT INTO "1dim" VALUES('2017-01-20T09:00:47', 25.1);
SELECT * FROM "1dim";
\ir include/ddl_ops_1.sql
\ir include/ddl_ops_2.sql