timescaledb/test/expected/ddl_errors.out
Erik Nordström 3cf9c857c4 Make errors and messages conform to style guide
Errors and messages are overhauled to conform to the official
PostgreSQL style guide. In particular, the following things from the
guide has been given special attention:

* Correct capitalization of first letter: capitalize only for hints,
  and detail messages.
* Correct handling of periods at the end of messages (should be elided
  for primary message, but not detail and hint messages).
* The primary message should be short, factual, and avoid reference to
  implementation details such as specific function names.

Some messages have also been reworded for clarity and to better
conform with the last bullet above (short primary message). In other
cases, messages have been updated to fix references to, e.g., function
parameters that used the wrong parameter name.

Closes #2364
2020-10-20 16:49:32 +02:00

147 lines
7.2 KiB
Plaintext

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
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(NULL, NULL);
ERROR: relation cannot be NULL
SELECT * FROM create_hypertable('"public"."Hypertable_1"', NULL);
ERROR: time column cannot be NULL
-- integer time dimensions require an explicit interval
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time');
ERROR: integer dimensions require an explicit interval
-- space dimensions require explicit number of partitions
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: invalid number of partitions for dimension "Device_id"
SELECT * FROM create_hypertable('"public"."Hypertable_1_mispelled"', 'time', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: relation "public.Hypertable_1_mispelled" does not exist at character 33
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time_mispelled', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: column "time_mispelled" does not exist
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'Device_id', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: invalid type for dimension "Device_id"
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id_mispelled', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: column "Device_id_mispelled" does not exist
INSERT INTO PUBLIC."Hypertable_1" VALUES(1,'dev_1', 3);
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Hypertable_1" is not empty
DELETE FROM PUBLIC."Hypertable_1" ;
\set ON_ERROR_STOP 1
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
hypertable_id | schema_name | table_name | created
---------------+-------------+--------------+---------
1 | public | Hypertable_1 | t
(1 row)
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2, chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Hypertable_1" is already a hypertable
\set ON_ERROR_STOP 1
INSERT INTO "Hypertable_1" VALUES (0, 1, 0);
\set ON_ERROR_STOP 0
ALTER TABLE _timescaledb_internal._hyper_1_1_chunk ALTER COLUMN temp_c DROP NOT NULL;
ERROR: operation not supported on chunk tables
\set ON_ERROR_STOP 1
CREATE TABLE PUBLIC."Parent" (
time BIGINT NOT NULL,
"Device_id" TEXT NOT NULL,
temp_c int NOT NULL DEFAULT -1
);
\set ON_ERROR_STOP 0
ALTER TABLE "Hypertable_1" INHERIT "Parent";
ERROR: hypertables do not support inheritance
ALTER TABLE _timescaledb_internal._hyper_1_1_chunk INHERIT "Parent";
ERROR: operation not supported on chunk tables
ALTER TABLE _timescaledb_internal._hyper_1_1_chunk NO INHERIT "Parent";
ERROR: operation not supported on chunk tables
\set ON_ERROR_STOP 1
CREATE TABLE PUBLIC."Child" () INHERITS ("Parent");
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Parent"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Parent" is already partitioned
SELECT * FROM create_hypertable('"public"."Child"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Child" is already partitioned
\set ON_ERROR_STOP 1
CREATE UNLOGGED TABLE PUBLIC."Hypertable_unlogged" (
time BIGINT NOT NULL,
"Device_id" TEXT NOT NULL,
temp_c int NOT NULL DEFAULT -1
);
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_unlogged"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Hypertable_unlogged" has to be logged
\set ON_ERROR_STOP 1
ALTER TABLE PUBLIC."Hypertable_unlogged" SET LOGGED;
SELECT * FROM create_hypertable('"public"."Hypertable_unlogged"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
hypertable_id | schema_name | table_name | created
---------------+-------------+---------------------+---------
2 | public | Hypertable_unlogged | t
(1 row)
CREATE TEMP TABLE "Hypertable_temp" (
time BIGINT NOT NULL,
"Device_id" TEXT NOT NULL,
temp_c int NOT NULL DEFAULT -1
);
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"Hypertable_temp"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Hypertable_temp" has to be logged
ALTER TABLE "Hypertable_1" SET UNLOGGED;
ERROR: logging cannot be turned off for hypertables
\set ON_ERROR_STOP 1
ALTER TABLE "Hypertable_1" SET LOGGED;
CREATE TABLE PUBLIC."Hypertable_1_replica_ident" (
time BIGINT NOT NULL,
"Device_id" TEXT NOT NULL,
temp_c int NOT NULL DEFAULT -1
);
ALTER TABLE "Hypertable_1_replica_ident" REPLICA IDENTITY FULL;
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_1_replica_ident"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: table "Hypertable_1_replica_ident" has replica identity set
ALTER TABLE "Hypertable_1" REPLICA IDENTITY FULL;
ERROR: hypertables do not support logical replication
\set ON_ERROR_STOP 1
CREATE TABLE PUBLIC."Hypertable_1_rule" (
time BIGINT NOT NULL,
"Device_id" TEXT NOT NULL,
temp_c int NOT NULL DEFAULT -1
);
CREATE RULE notify_me AS ON UPDATE TO "Hypertable_1_rule" DO ALSO NOTIFY "Hypertable_1_rule";
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_1_rule"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: hypertables do not support rules
\set ON_ERROR_STOP 1
ALTER TABLE "Hypertable_1_rule" DISABLE RULE notify_me;
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_1_rule"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
ERROR: hypertables do not support rules
\set ON_ERROR_STOP 1
DROP RULE notify_me ON "Hypertable_1_rule";
SELECT * FROM create_hypertable('"public"."Hypertable_1_rule"', 'time', chunk_time_interval=>_timescaledb_internal.interval_to_usec('1 month'));
hypertable_id | schema_name | table_name | created
---------------+-------------+-------------------+---------
3 | public | Hypertable_1_rule | t
(1 row)
\set ON_ERROR_STOP 0
CREATE RULE notify_me AS ON UPDATE TO "Hypertable_1_rule" DO ALSO NOTIFY "Hypertable_1_rule";
ERROR: hypertables do not support rules
\set ON_ERROR_STOP 1
\set ON_ERROR_STOP 0
SELECT add_dimension(NULL,NULL);
ERROR: hypertable cannot be NULL
\set ON_ERROR_STOP 1
\set ON_ERROR_STOP 0
SELECT attach_tablespace(NULL,NULL);
ERROR: invalid tablespace name
\set ON_ERROR_STOP 1
\set ON_ERROR_STOP 0
select set_number_partitions(NULL,NULL);
ERROR: hypertable cannot be NULL
\set ON_ERROR_STOP 1