mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
If a user attempts to setup a database while not connecting using the network, port is NULL and thus fails constraint checks. Instead, we now use the default Postgres port of 5432 when this happens. Also, setup_db() is renamed to setup_timescaledb() for clarity in the presence of other extensions.
65 lines
2.7 KiB
Plaintext
65 lines
2.7 KiB
Plaintext
\set ON_ERROR_STOP 1
|
|
\set VERBOSITY verbose
|
|
\set SHOW_CONTEXT never
|
|
\o /dev/null
|
|
\ir include/create_single_db.sql
|
|
\set VERBOSITY default
|
|
SET client_min_messages = WARNING;
|
|
DROP DATABASE IF EXISTS single;
|
|
SET client_min_messages = NOTICE;
|
|
CREATE DATABASE single;
|
|
\c single
|
|
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
|
|
psql:include/create_single_db.sql:8: NOTICE: installing required extension "dblink"
|
|
psql:include/create_single_db.sql:8: NOTICE: installing required extension "postgres_fdw"
|
|
psql:include/create_single_db.sql:8: NOTICE: installing required extension "hstore"
|
|
SELECT setup_timescaledb(hostname => 'fakehost'); -- fakehost makes sure there is no network connection
|
|
\set VERBOSITY verbose
|
|
\o
|
|
\set ECHO ALL
|
|
\c single
|
|
-- Expect error when adding user again
|
|
\set ON_ERROR_STOP 0
|
|
SELECT add_cluster_user();
|
|
ERROR: IO130: User postgres already exists
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|
|
\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);
|
|
ERROR: 42P01: relation "public.Hypertable_1_mispelled" does not exist
|
|
LINE 1: SELECT * FROM create_hypertable('"public"."Hypertable_1_misp...
|
|
^
|
|
LOCATION: RangeVarGetRelidExtended, namespace.c:415
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time_mispelled', 'Device_id', 2);
|
|
ERROR: IO102: column "time_mispelled" does not exist
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'Device_id', 'Device_id', 2);
|
|
ERROR: IO102: illegal type for time column "Device_id": text
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id_mispelled', 2);
|
|
ERROR: IO102: column "Device_id_mispelled" does not exist
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|
|
INSERT INTO PUBLIC."Hypertable_1" VALUES(1,'dev_1', 3);
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|
|
ERROR: IO102: the table being converted to a hypertable must be empty
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|
|
DELETE FROM PUBLIC."Hypertable_1" ;
|
|
\set ON_ERROR_STOP 1
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|
|
create_hypertable
|
|
-------------------
|
|
|
|
(1 row)
|
|
|
|
\set ON_ERROR_STOP 0
|
|
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id', 2);
|
|
ERROR: IO110: hypertable "Hypertable_1" already exists
|
|
LOCATION: exec_stmt_raise, pl_exec.c:3165
|