Merged in schema-cleanup (pull request #61)

Allow extension to be installed in a different schema
This commit is contained in:
Matvey Arye 2017-01-30 17:07:13 +00:00
commit 9c9ef0981f
49 changed files with 322 additions and 325 deletions

View File

@ -8,7 +8,7 @@ CREATE OR REPLACE FUNCTION _iobeamdb_meta_api.create_hypertable(
number_partitions SMALLINT,
associated_schema_name NAME,
associated_table_prefix NAME,
placement chunk_placement_type,
placement _iobeamdb_catalog.chunk_placement_type,
chunk_size_bytes BIGINT
)
RETURNS _iobeamdb_catalog.hypertable LANGUAGE PLPGSQL VOLATILE AS

View File

@ -7,7 +7,7 @@
-- node (it stores remote wrappers to update meta tables on data nodes).
CREATE TABLE IF NOT EXISTS _iobeamdb_catalog.node (
database_name NAME NOT NULL PRIMARY KEY,
schema_name NAME NOT NULL UNIQUE, --public schema of remote
schema_name NAME NOT NULL UNIQUE, --the schema name with remote tables to _iobeamdb_catalog schema of the node
server_name NAME NOT NULL UNIQUE,
hostname TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
@ -51,21 +51,21 @@ SELECT pg_catalog.pg_extension_config_dump('_iobeamdb_catalog.cluster_user', '')
-- The name and type of the time column (used to partition on time) are defined
-- in `time_column_name` and `time_column_type`.
CREATE TABLE IF NOT EXISTS _iobeamdb_catalog.hypertable (
id SERIAL PRIMARY KEY,
schema_name NAME NOT NULL,
table_name NAME NOT NULL,
associated_schema_name NAME NOT NULL,
associated_table_prefix NAME NOT NULL,
root_schema_name NAME NOT NULL,
root_table_name NAME NOT NULL,
distinct_schema_name NAME NOT NULL,
distinct_table_name NAME NOT NULL,
replication_factor SMALLINT NOT NULL CHECK (replication_factor > 0),
placement chunk_placement_type NOT NULL,
time_column_name NAME NOT NULL,
time_column_type REGTYPE NOT NULL,
created_on NAME NOT NULL REFERENCES _iobeamdb_catalog.node(database_name),
chunk_size_bytes BIGINT NOT NULL CHECK (chunk_size_bytes > 0),
id SERIAL PRIMARY KEY,
schema_name NAME NOT NULL,
table_name NAME NOT NULL,
associated_schema_name NAME NOT NULL,
associated_table_prefix NAME NOT NULL,
root_schema_name NAME NOT NULL,
root_table_name NAME NOT NULL,
distinct_schema_name NAME NOT NULL,
distinct_table_name NAME NOT NULL,
replication_factor SMALLINT NOT NULL CHECK (replication_factor > 0),
placement _iobeamdb_catalog.chunk_placement_type NOT NULL,
time_column_name NAME NOT NULL,
time_column_type REGTYPE NOT NULL,
created_on NAME NOT NULL REFERENCES _iobeamdb_catalog.node(database_name),
chunk_size_bytes BIGINT NOT NULL CHECK (chunk_size_bytes > 0),
UNIQUE (schema_name, table_name),
UNIQUE (associated_schema_name, associated_table_prefix),
UNIQUE (root_schema_name, root_table_name)
@ -148,16 +148,18 @@ SELECT pg_catalog.pg_extension_config_dump('_iobeamdb_catalog.distinct_replica_n
-- Changing a data's partitioning, and thus creating a new epoch, should be done
-- INFREQUENTLY as it's expensive operation.
CREATE TABLE IF NOT EXISTS _iobeamdb_catalog.partition_epoch (
id SERIAL NOT NULL PRIMARY KEY,
hypertable_id INTEGER NOT NULL REFERENCES _iobeamdb_catalog.hypertable(id) ON DELETE CASCADE,
start_time BIGINT NULL CHECK (start_time >= 0),
end_time BIGINT NULL CHECK (end_time >= 0),
partitioning_func NAME NULL, --function name of a function of the form func(data_value, partitioning_mod) -> [0, partitioning_mod)
partitioning_mod INT NOT NULL CHECK (partitioning_mod < 65536),
partitioning_column NAME NULL,
id SERIAL NOT NULL PRIMARY KEY,
hypertable_id INTEGER NOT NULL REFERENCES _iobeamdb_catalog.hypertable(id) ON DELETE CASCADE,
start_time BIGINT NULL CHECK (start_time >= 0),
end_time BIGINT NULL CHECK (end_time >= 0),
partitioning_func_schema NAME NULL,
partitioning_func NAME NULL, --function name of a function of the form func(data_value, partitioning_mod) -> [0, partitioning_mod)
partitioning_mod INT NOT NULL CHECK (partitioning_mod < 65536),
partitioning_column NAME NULL,
UNIQUE (hypertable_id, start_time),
UNIQUE (hypertable_id, end_time),
CHECK (start_time <= end_time)
CHECK (start_time <= end_time),
CHECK ((partitioning_func_schema IS NULL AND partitioning_func IS NULL) OR (partitioning_func_schema IS NOT NULL AND partitioning_func IS NOT NULL))
);
SELECT pg_catalog.pg_extension_config_dump('_iobeamdb_catalog.partition_epoch', '');
SELECT pg_catalog.pg_extension_config_dump(pg_get_serial_sequence('_iobeamdb_catalog.partition_epoch','id'), '');

View File

@ -1,23 +1,4 @@
CREATE SCHEMA IF NOT EXISTS _iobeamdb_catalog;
DO
$BODY$
BEGIN
IF NOT EXISTS(SELECT 1
FROM pg_type
WHERE typname = 'field_index_type') THEN
CREATE TYPE field_index_type AS ENUM ('TIME-VALUE', 'VALUE-TIME');
END IF;
END
$BODY$;
CREATE TYPE _iobeamdb_catalog.chunk_placement_type AS ENUM ('RANDOM', 'STICKY');
DO
$BODY$
BEGIN
IF NOT EXISTS(SELECT 1
FROM pg_type
WHERE typname = 'chunk_placement_type') THEN
CREATE TYPE chunk_placement_type AS ENUM ('RANDOM', 'STICKY');
END IF;
END
$BODY$;

View File

@ -16,5 +16,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -68,5 +68,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -11,5 +11,4 @@ BEGIN
END IF;
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -31,5 +31,4 @@ BEGIN
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -17,7 +17,7 @@ CREATE OR REPLACE FUNCTION create_hypertable(
number_partitions SMALLINT = NULL,
associated_schema_name NAME = NULL,
associated_table_prefix NAME = NULL,
placement chunk_placement_type = 'STICKY',
placement _iobeamdb_catalog.chunk_placement_type = 'STICKY',
chunk_size_bytes BIGINT = 1073741824 -- 1 GB
)
RETURNS VOID LANGUAGE PLPGSQL VOLATILE AS

View File

@ -12,6 +12,7 @@ $BODY$
DECLARE
def TEXT;
c INTEGER;
index_name TEXT;
BEGIN
--get definition text
def = pg_get_indexdef(index_oid);
@ -25,12 +26,18 @@ BEGIN
def = replace(def, 'ON '||table_oid::TEXT || ' USING', 'ON /*TABLE_NAME*/ USING');
--replace index name with /*INDEX_NAME*/
SELECT relname
INTO STRICT index_name --index name in def is never schema qualified
FROM pg_class
WHERE OID = index_oid;
SELECT count(*) INTO c
FROM regexp_matches(def, 'CREATE INDEX '|| index_oid || ' ON', 'g');
FROM regexp_matches(def, 'CREATE INDEX '|| format('%I', index_name) || ' ON', 'g');
IF c <> 1 THEN
RAISE EXCEPTION 'Cannot process index with definition (no index name match) %', def;
END IF;
def = replace(def, 'CREATE INDEX '|| index_oid || ' ON', 'CREATE INDEX /*INDEX_NAME*/ ON');
def = replace(def, 'CREATE INDEX '|| format('%I', index_name) || ' ON', 'CREATE INDEX /*INDEX_NAME*/ ON');
RETURN def;
END

View File

@ -28,5 +28,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -299,8 +299,7 @@ BEGIN
END IF;
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;
-- Trigger to remove a column from a hypertable.
-- Called when the user alters the main table by deleting a column.
@ -337,4 +336,4 @@ BEGIN
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
;

View File

@ -81,8 +81,7 @@ BEGIN
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;
/*
@ -108,5 +107,4 @@ BEGIN
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -19,5 +19,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -78,8 +78,7 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET client_min_messages = WARNING --suppress NOTICE on IF EXISTS schema
SET SEARCH_PATH = 'public';
SET client_min_messages = WARNING; --suppress NOTICE on IF EXISTS schema
/*
@ -107,4 +106,4 @@ BEGIN
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
;

View File

@ -35,10 +35,10 @@ BEGIN
SELECT p.*
FROM _iobeamdb_catalog.partition p
WHERE p.epoch_id = %L AND
%s((SELECT row.%I FROM (SELECT (%L::%s).*) as row)::TEXT, %L)
%I.%I((SELECT row.%I FROM (SELECT (%L::%s).*) as row)::TEXT, %L)
BETWEEN p.keyspace_start AND p.keyspace_end
$$,
epoch.id, epoch.partitioning_func,
epoch.id, epoch.partitioning_func_schema, epoch.partitioning_func,
epoch.partitioning_column,
copy_record, copy_table_name, epoch.partitioning_mod)
INTO STRICT partition_row;
@ -117,7 +117,7 @@ BEGIN
SELECT _iobeamdb_internal.get_time_column_from_record(h.time_column_name, h.time_column_type, ct, '%1$s') AS time,
h.time_column_name, h.time_column_type,
p.id AS partition_id, p.keyspace_start, p.keyspace_end,
pe.partitioning_func, pe.partitioning_column, pe.partitioning_mod
pe.partitioning_func_schema, pe.partitioning_func, pe.partitioning_column, pe.partitioning_mod
FROM ONLY %1$s ct
LEFT JOIN _iobeamdb_catalog.hypertable h ON (h.id = %2$L)
LEFT JOIN _iobeamdb_catalog.partition_epoch pe ON (
@ -201,11 +201,12 @@ BEGIN
partition_constraint_where_clause := format(
$$
WHERE (%1$I >= %2$s OR %2$s IS NULL) AND (%1$I <= %3$s OR %3$s IS NULL) AND
(%4$s(%5$I::TEXT, %6$L) BETWEEN %7$L AND %8$L)
(%4$I.%5$I(%6$I::TEXT, %7$L) BETWEEN %8$L AND %9$L)
$$,
point_record.time_column_name,
_iobeamdb_internal.time_literal_sql(chunk_row.start_time, point_record.time_column_type),
_iobeamdb_internal.time_literal_sql(chunk_row.end_time, point_record.time_column_type),
point_record.partitioning_func_schema,
point_record.partitioning_func,
point_record.partitioning_column,
point_record.partitioning_mod,

View File

@ -18,5 +18,4 @@ BEGIN
END IF;
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -18,5 +18,4 @@ BEGIN
END IF;
RETURN NEW;
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -19,5 +19,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION get_partition_for_key(
CREATE OR REPLACE FUNCTION _iobeamdb_catalog.get_partition_for_key(
key TEXT,
mod_factor INT
)

View File

@ -71,8 +71,8 @@ BEGIN
SELECT p.*
FROM _iobeamdb_catalog.partition p
WHERE p.epoch_id = %L AND
%s(%L::TEXT, %L) BETWEEN p.keyspace_start AND p.keyspace_end
$$, epoch.id, epoch.partitioning_func, key_value, epoch.partitioning_mod)
%I.%I(%L::TEXT, %L) BETWEEN p.keyspace_start AND p.keyspace_end
$$, epoch.id, epoch.partitioning_func_schema, epoch.partitioning_func, key_value, epoch.partitioning_mod)
INTO STRICT partition_row;
END IF;
RETURN partition_row;

View File

@ -235,10 +235,10 @@ BEGIN
EXECUTE format(
$$
ALTER TABLE %1$I.%2$I
ADD CONSTRAINT partition CHECK(%3$s(%4$I::text, %5$L) BETWEEN %6$L AND %7$L)
ADD CONSTRAINT partition CHECK(%3$I.%4$s(%5$I::text, %6$L) BETWEEN %7$L AND %8$L)
$$,
schema_name, table_name,
epoch_row.partitioning_func, epoch_row.partitioning_column,
epoch_row.partitioning_func_schema, epoch_row.partitioning_func, epoch_row.partitioning_column,
epoch_row.partitioning_mod, keyspace_start, keyspace_end);
END IF;
END

View File

@ -22,5 +22,4 @@ BEGIN
PERFORM _iobeamdb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$
SET SEARCH_PATH = 'public';
$BODY$;

View File

@ -1,6 +1,6 @@
CREATE OR REPLACE FUNCTION _iobeamdb_meta.place_chunks(
chunk_row _iobeamdb_catalog.chunk,
placement chunk_placement_type,
placement _iobeamdb_catalog.chunk_placement_type,
replication_factor SMALLINT
)
RETURNS TABLE(replica_id SMALLINT, database_name NAME) LANGUAGE PLPGSQL AS

View File

@ -38,7 +38,7 @@ DECLARE
BEGIN
schema_name := format('remote_%s', database_name);
IF database_name = current_database() THEN
schema_name = 'public';
schema_name = '_iobeamdb_catalog';
END IF;
BEGIN
@ -72,16 +72,18 @@ END
$BODY$;
CREATE OR REPLACE FUNCTION add_partition_epoch(
hypertable_id INTEGER,
keyspace_start SMALLINT [],
partitioning_column NAME,
partitioning_func TEXT
hypertable_id INTEGER,
keyspace_start SMALLINT [],
partitioning_column NAME,
partitioning_func_schema NAME,
partitioning_func NAME
)
RETURNS VOID LANGUAGE SQL VOLATILE AS
$BODY$
WITH epoch AS (
INSERT INTO _iobeamdb_catalog.partition_epoch (hypertable_id, start_time, end_time, partitioning_func, partitioning_mod, partitioning_column)
VALUES (hypertable_id, NULL, NULL, partitioning_func, 32768, partitioning_column)
INSERT INTO _iobeamdb_catalog.partition_epoch (hypertable_id, start_time, end_time, partitioning_func_schema,
partitioning_func, partitioning_mod, partitioning_column)
VALUES (hypertable_id, NULL, NULL, partitioning_func_schema, partitioning_func, 32768, partitioning_column)
RETURNING id
)
INSERT INTO _iobeamdb_catalog.partition (epoch_id, keyspace_start, keyspace_end)
@ -94,10 +96,11 @@ $BODY$
$BODY$;
CREATE OR REPLACE FUNCTION add_equi_partition_epoch(
hypertable_id INTEGER,
number_partitions SMALLINT,
partitioning_column NAME,
partitioning_func TEXT
hypertable_id INTEGER,
number_partitions SMALLINT,
partitioning_column NAME,
partitioning_func_schema NAME,
partitioning_func NAME
)
RETURNS VOID LANGUAGE SQL VOLATILE AS
$BODY$
@ -106,6 +109,7 @@ SELECT add_partition_epoch(
(SELECT ARRAY(SELECT start * 32768 / (number_partitions)
FROM generate_series(1, number_partitions - 1) AS start) :: SMALLINT []),
partitioning_column,
partitioning_func_schema,
partitioning_func
)
$BODY$;

View File

@ -12,16 +12,17 @@ CREATE OR REPLACE FUNCTION _iobeamdb_meta.create_hypertable(
number_partitions SMALLINT,
associated_schema_name NAME,
associated_table_prefix NAME,
placement chunk_placement_type,
placement _iobeamdb_catalog.chunk_placement_type,
chunk_size_bytes BIGINT,
created_on NAME
)
RETURNS _iobeamdb_catalog.hypertable LANGUAGE PLPGSQL VOLATILE AS
$BODY$
DECLARE
id INTEGER;
hypertable_row _iobeamdb_catalog.hypertable;
partitioning_func TEXT = 'get_partition_for_key';
id INTEGER;
hypertable_row _iobeamdb_catalog.hypertable;
partitioning_func _iobeamdb_catalog.partition_epoch.partitioning_func%TYPE = 'get_partition_for_key';
partitioning_func_schema _iobeamdb_catalog.partition_epoch.partitioning_func_schema%TYPE = '_iobeamdb_catalog';
BEGIN
id := nextval('_iobeamdb_catalog.default_hypertable_seq');
@ -38,6 +39,7 @@ BEGIN
IF number_partitions IS NULL THEN
number_partitions := 1;
partitioning_func := NULL;
partitioning_func_schema := NULL;
ELSIF number_partitions <> 1 THEN
RAISE EXCEPTION 'The number of partitions must be 1 without a partitioning column'
USING ERRCODE ='IO101';
@ -72,7 +74,7 @@ BEGIN
RETURNING * INTO hypertable_row;
IF number_partitions != 0 THEN
PERFORM add_equi_partition_epoch(hypertable_row.id, number_partitions, partitioning_column, partitioning_func);
PERFORM add_equi_partition_epoch(hypertable_row.id, number_partitions, partitioning_column, partitioning_func_schema, partitioning_func);
END IF;
RETURN hypertable_row;
END

View File

@ -5,7 +5,7 @@
\o
\set ECHO ALL
\c Test1
\c test2
SELECT * FROM "testNs";

View File

@ -15,10 +15,10 @@ SELECT add_node('Test1' :: NAME, 'localhost');
SELECT add_node('test2' :: NAME, 'localhost');
\c Test1
CREATE TABLE drop_chunk_test1(time bigint, temp float8, device_id text);
CREATE TABLE drop_chunk_test2(time bigint, temp float8, device_id text);
SELECT create_hypertable('drop_chunk_test1', 'time', 'device_id', chunk_size_bytes => 10000);
SELECT create_hypertable('drop_chunk_test2', 'time', 'device_id', chunk_size_bytes => 10000);
CREATE TABLE PUBLIC.drop_chunk_test1(time bigint, temp float8, device_id text);
CREATE TABLE PUBLIC.drop_chunk_test2(time bigint, temp float8, device_id text);
SELECT create_hypertable('public.drop_chunk_test1', 'time', 'device_id', chunk_size_bytes => 10000);
SELECT create_hypertable('public.drop_chunk_test2', 'time', 'device_id', chunk_size_bytes => 10000);
SELECT c.id AS chunk_id, pr.partition_id, pr.hypertable_id, crn.schema_name AS chunk_schema, crn.table_name AS chunk_table, c.start_time, c.end_time
FROM _iobeamdb_catalog.chunk c
@ -29,22 +29,22 @@ WHERE h.schema_name = 'public' AND (h.table_name = 'drop_chunk_test1' OR h.table
\dt "_iobeamdb_internal".*
SELECT get_partition_for_key('dev1', 32768);
SELECT get_partition_for_key('dev7', 32768);
SELECT _iobeamdb_catalog.get_partition_for_key('dev1', 32768);
SELECT _iobeamdb_catalog.get_partition_for_key('dev7', 32768);
INSERT INTO drop_chunk_test1 VALUES(1, 1.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(2, 2.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(3, 3.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(4, 4.0, 'dev7');
INSERT INTO drop_chunk_test1 VALUES(5, 5.0, 'dev7');
INSERT INTO drop_chunk_test1 VALUES(6, 6.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(1, 1.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(2, 2.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(3, 3.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(4, 4.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(5, 5.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(6, 6.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(1, 1.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(2, 2.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(3, 3.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(4, 4.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(5, 5.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(6, 6.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(1, 1.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(2, 2.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(3, 3.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(4, 4.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(5, 5.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(6, 6.0, 'dev7');
SELECT c.id AS chunk_id, pr.partition_id, pr.hypertable_id, crn.schema_name AS chunk_schema, crn.table_name AS chunk_table, c.start_time, c.end_time
FROM _iobeamdb_catalog.chunk c

View File

@ -9,22 +9,22 @@ LOCATION: CreateExtensionInternal, extension.c:1441
(1 row)
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
setup_main
------------
(1 row)
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
setup_main
------------
@ -97,7 +97,7 @@ SELECT * FROM create_hypertable('"public"."testNs"', 'time', 'Device_id');
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."testNs"', 'time', 'Device_id');
psql:cluster.sql:45: ERROR: IO110: hypertable "testNs" already exists
psql:cluster.sql:45: ERROR: IO110: hypertable public."testNs" already exists
LOCATION: exec_stmt_raise, pl_exec.c:3165
\set ON_ERROR_STOP 1
SELECT * FROM create_hypertable('"public"."testNs2"', 'time', 'Device_id');
@ -170,10 +170,10 @@ FROM _iobeamdb_catalog.distinct_replica_node;
SELECT *
FROM _iobeamdb_catalog.partition_epoch;
id | hypertable_id | start_time | end_time | partitioning_func | partitioning_mod | partitioning_column
----+---------------+------------+----------+-----------------------+------------------+---------------------
1 | 1 | | | get_partition_for_key | 32768 | Device_id
2 | 3 | | | get_partition_for_key | 32768 | Device_id
id | hypertable_id | start_time | end_time | partitioning_func_schema | partitioning_func | partitioning_mod | partitioning_column
----+---------------+------------+----------+--------------------------+-----------------------+------------------+---------------------
1 | 1 | | | _iobeamdb_catalog | get_partition_for_key | 32768 | Device_id
2 | 3 | | | _iobeamdb_catalog | get_partition_for_key | 32768 | Device_id
(2 rows)
SELECT *
@ -287,10 +287,10 @@ FROM _iobeamdb_catalog.distinct_replica_node;
SELECT *
FROM _iobeamdb_catalog.partition_epoch;
id | hypertable_id | start_time | end_time | partitioning_func | partitioning_mod | partitioning_column
----+---------------+------------+----------+-----------------------+------------------+---------------------
1 | 1 | | | get_partition_for_key | 32768 | Device_id
2 | 3 | | | get_partition_for_key | 32768 | Device_id
id | hypertable_id | start_time | end_time | partitioning_func_schema | partitioning_func | partitioning_mod | partitioning_column
----+---------------+------------+----------+--------------------------+-----------------------+------------------+---------------------
1 | 1 | | | _iobeamdb_catalog | get_partition_for_key | 32768 | Device_id
2 | 3 | | | _iobeamdb_catalog | get_partition_for_key | 32768 | Device_id
(2 rows)
SELECT *
@ -413,7 +413,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_partition,
latitude | bigint | | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -428,7 +428,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
@ -442,7 +442,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Table "_iobeamdb_internal._hyper_1_distinct"
@ -502,7 +502,7 @@ Child tables: _iobeamdb_internal._hyper_3_3_0_partition,
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_4_0_partition"
@ -515,7 +515,7 @@ Inherits: _iobeamdb_internal._hyper_3_0_replica
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_distinct"
@ -600,7 +600,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_partition,
latitude | bigint | | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -615,7 +615,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
@ -629,7 +629,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Table "_iobeamdb_internal._hyper_1_distinct"
@ -689,7 +689,7 @@ Child tables: _iobeamdb_internal._hyper_3_3_0_partition,
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_4_0_partition"
@ -702,7 +702,7 @@ Inherits: _iobeamdb_internal._hyper_3_0_replica
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_distinct"
@ -811,7 +811,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_partition,
latitude | bigint | | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -826,7 +826,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
@ -840,7 +840,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_1_data
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Table "_iobeamdb_internal._hyper_1_distinct"
@ -900,7 +900,7 @@ Child tables: _iobeamdb_internal._hyper_3_3_0_partition,
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_4_0_partition"
@ -913,7 +913,7 @@ Inherits: _iobeamdb_internal._hyper_3_0_replica
latitude | bigint | | plain | |
really_long_column_goes_on_and_on_and_on_and_on_and_on_and_on_a | bigint | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_3_0_replica
Table "_iobeamdb_internal._hyper_3_distinct"

View File

@ -9,22 +9,22 @@ LOCATION: CreateExtensionInternal, extension.c:1441
(1 row)
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
setup_main
------------
(1 row)
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
setup_main
------------

View File

@ -4,17 +4,17 @@ psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required ext
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
\c meta
SELECT add_cluster_user('postgres', NULL);
@ -87,14 +87,14 @@ SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_2', TRUE);
(1 row)
INSERT INTO "Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
INSERT INTO PUBLIC."Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
VALUES(1257894000000000000, 'dev1', 30, 70, 1, 2, 3, 100);
--expect error cases
\set ON_ERROR_STOP 0
UPDATE ONLY "Hypertable_1" SET time = 0 WHERE TRUE;
UPDATE ONLY PUBLIC."Hypertable_1" SET time = 0 WHERE TRUE;
psql:include/ddl_ops_1.sql:27: ERROR: IO101: UPDATE ONLY not supported on hypertables
LOCATION: exec_stmt_raise, pl_exec.c:3165
DELETE FROM ONLY "Hypertable_1" WHERE "Device_id" = 'dev1';
DELETE FROM ONLY PUBLIC."Hypertable_1" WHERE "Device_id" = 'dev1';
psql:include/ddl_ops_1.sql:28: ERROR: IO101: DELETE ONLY not currently supported on hypertables
LOCATION: exec_stmt_raise, pl_exec.c:3165
\set ON_ERROR_STOP 1
@ -143,8 +143,8 @@ Indexes:
"ind_humidity" btree ("time", humidity)
"ind_sensor_1" btree ("time", sensor_1)
Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_unsupported_main_table()
insert_trigger AFTER INSERT ON public."Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON public."Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_unsupported_main_table()
\d+ "_iobeamdb_internal"."_hyper_1_root"
Table "_iobeamdb_internal._hyper_1_root"
@ -173,7 +173,7 @@ Child tables: _iobeamdb_internal._hyper_1_0_replica
sensor_3 | numeric | not null default 1 | | main | |
sensor_4 | numeric | not null default 1 | | main | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -318,8 +318,8 @@ Indexes:
"Hypertable_1_time_Device_id_idx" btree ("time", "Device_id")
"ind_humidity" btree ("time", humidity)
Triggers:
insert_trigger AFTER INSERT ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON "Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_unsupported_main_table()
insert_trigger AFTER INSERT ON public."Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_modify_main_table()
modify_trigger BEFORE DELETE OR UPDATE ON public."Hypertable_1" FOR EACH STATEMENT EXECUTE PROCEDURE _iobeamdb_internal.on_unsupported_main_table()
\d+ "_iobeamdb_internal"."_hyper_1_root"
Table "_iobeamdb_internal._hyper_1_root"
@ -350,7 +350,7 @@ Child tables: _iobeamdb_internal._hyper_1_0_replica
sensor_3 | bigint | not null default 131 | | plain | |
sensor_4 | bigint | not null default 131 | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '16383'::smallint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
Inherits: _iobeamdb_internal._hyper_1_1_0_partition

View File

@ -4,17 +4,17 @@ psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required ext
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
\c meta
SELECT add_cluster_user('postgres', NULL);
@ -92,7 +92,7 @@ SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id');
\set ON_ERROR_STOP 0
SELECT * FROM create_hypertable('"public"."Hypertable_1"', 'time', 'Device_id');
psql:ddl_errors.sql:54: ERROR: IO110: hypertable "Hypertable_1" already exists
psql:ddl_errors.sql:54: ERROR: IO110: hypertable public."Hypertable_1" already exists
LOCATION: exec_stmt_raise, pl_exec.c:3165
SELECT set_is_distinct_flag('"public"."Hypertable_1_misspelled"', 'mispelled', true);
psql:ddl_errors.sql:55: ERROR: 42P01: relation "public.Hypertable_1_misspelled" does not exist

View File

@ -68,14 +68,14 @@ SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_2', TRUE);
(1 row)
INSERT INTO "Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
INSERT INTO PUBLIC."Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
VALUES(1257894000000000000, 'dev1', 30, 70, 1, 2, 3, 100);
--expect error cases
\set ON_ERROR_STOP 0
UPDATE ONLY "Hypertable_1" SET time = 0 WHERE TRUE;
UPDATE ONLY PUBLIC."Hypertable_1" SET time = 0 WHERE TRUE;
psql:include/ddl_ops_1.sql:27: ERROR: IO101: UPDATE ONLY not supported on hypertables
LOCATION: exec_stmt_raise, pl_exec.c:3165
DELETE FROM ONLY "Hypertable_1" WHERE "Device_id" = 'dev1';
DELETE FROM ONLY PUBLIC."Hypertable_1" WHERE "Device_id" = 'dev1';
psql:include/ddl_ops_1.sql:28: ERROR: IO101: DELETE ONLY not currently supported on hypertables
LOCATION: exec_stmt_raise, pl_exec.c:3165
\set ON_ERROR_STOP 1
@ -189,7 +189,7 @@ Indexes:
"1-Hypertable_1_time_Device_id_idx" btree ("time", "Device_id")
"3-ind_humidity" btree ("time", humidity)
Check constraints:
"partition" CHECK (get_partition_for_key("Device_id", 32768) >= '0'::smallint AND get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key("Device_id", 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key("Device_id", 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
SELECT * FROM _iobeamdb_internal._hyper_1_0_1_distinct_data;

View File

@ -1,13 +1,13 @@
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
\c Test1
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
\c test2
SELECT * FROM "testNs";
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------

View File

@ -4,17 +4,17 @@ psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required ext
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
\c meta
SELECT add_cluster_user('postgres', NULL);
@ -42,15 +42,15 @@ SELECT add_node('test2' :: NAME, 'localhost');
(1 row)
\c Test1
CREATE TABLE drop_chunk_test1(time bigint, temp float8, device_id text);
CREATE TABLE drop_chunk_test2(time bigint, temp float8, device_id text);
SELECT create_hypertable('drop_chunk_test1', 'time', 'device_id', chunk_size_bytes => 10000);
CREATE TABLE PUBLIC.drop_chunk_test1(time bigint, temp float8, device_id text);
CREATE TABLE PUBLIC.drop_chunk_test2(time bigint, temp float8, device_id text);
SELECT create_hypertable('public.drop_chunk_test1', 'time', 'device_id', chunk_size_bytes => 10000);
create_hypertable
-------------------
(1 row)
SELECT create_hypertable('drop_chunk_test2', 'time', 'device_id', chunk_size_bytes => 10000);
SELECT create_hypertable('public.drop_chunk_test2', 'time', 'device_id', chunk_size_bytes => 10000);
create_hypertable
-------------------
@ -84,30 +84,30 @@ WHERE h.schema_name = 'public' AND (h.table_name = 'drop_chunk_test1' OR h.table
_iobeamdb_internal | _hyper_2_root | table | postgres
(12 rows)
SELECT get_partition_for_key('dev1', 32768);
SELECT _iobeamdb_catalog.get_partition_for_key('dev1', 32768);
get_partition_for_key
-----------------------
14660
(1 row)
SELECT get_partition_for_key('dev7', 32768);
SELECT _iobeamdb_catalog.get_partition_for_key('dev7', 32768);
get_partition_for_key
-----------------------
21278
(1 row)
INSERT INTO drop_chunk_test1 VALUES(1, 1.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(2, 2.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(3, 3.0, 'dev1');
INSERT INTO drop_chunk_test1 VALUES(4, 4.0, 'dev7');
INSERT INTO drop_chunk_test1 VALUES(5, 5.0, 'dev7');
INSERT INTO drop_chunk_test1 VALUES(6, 6.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(1, 1.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(2, 2.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(3, 3.0, 'dev1');
INSERT INTO drop_chunk_test2 VALUES(4, 4.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(5, 5.0, 'dev7');
INSERT INTO drop_chunk_test2 VALUES(6, 6.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(1, 1.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(2, 2.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(3, 3.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(4, 4.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(5, 5.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test1 VALUES(6, 6.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(1, 1.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(2, 2.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(3, 3.0, 'dev1');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(4, 4.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(5, 5.0, 'dev7');
INSERT INTO PUBLIC.drop_chunk_test2 VALUES(6, 6.0, 'dev7');
SELECT c.id AS chunk_id, pr.partition_id, pr.hypertable_id, crn.schema_name AS chunk_schema, crn.table_name AS chunk_table, c.start_time, c.end_time
FROM _iobeamdb_catalog.chunk c
INNER JOIN _iobeamdb_catalog.chunk_replica_node crn ON (c.id = crn.chunk_id)

View File

@ -1,12 +1,12 @@
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
\c Test1
\d+ "_iobeamdb_internal".*
Index "_iobeamdb_internal.1-testNs_device_id_timeCustom_idx"
@ -101,7 +101,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_partition,
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
@ -117,7 +117,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_2_data')
@ -133,7 +133,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data,
_iobeamdb_internal._hyper_1_1_0_2_data
@ -154,7 +154,7 @@ Indexes:
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_2_0_partition
Table "_iobeamdb_internal._hyper_1_2_0_partition"
@ -167,7 +167,7 @@ Inherits: _iobeamdb_internal._hyper_1_2_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_2_0_3_data
@ -232,7 +232,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_partition,
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_4_data')
@ -245,7 +245,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_5_data')
@ -258,7 +258,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_6_data')
@ -271,7 +271,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
_iobeamdb_internal._hyper_2_3_0_5_data,
@ -284,7 +284,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Table "_iobeamdb_internal._hyper_2_distinct"
@ -340,14 +340,14 @@ SELECT * FROM _iobeamdb_catalog.hypertable;
id | schema_name | table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_column_name | time_column_type | created_on | chunk_size_bytes
----+-------------+--------------------+------------------------+-------------------------+--------------------+-----------------+----------------------+---------------------+--------------------+-----------+------------------+------------------+------------+------------------
1 | public | testNs | _iobeamdb_internal | _hyper_1 | _iobeamdb_internal | _hyper_1_root | _iobeamdb_internal | _hyper_1_distinct | 1 | STICKY | timeCustom | bigint | Test1 | 1073741824
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
(2 rows)
DROP TABLE "testNs";
SELECT * FROM _iobeamdb_catalog.hypertable;
id | schema_name | table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_column_name | time_column_type | created_on | chunk_size_bytes
----+-------------+--------------------+------------------------+-------------------------+--------------------+-----------------+----------------------+---------------------+--------------------+-----------+------------------+------------------+------------+------------------
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
(1 row)
\dt "public".*
@ -401,7 +401,7 @@ SELECT * FROM _iobeamdb_catalog.hypertable;
SELECT * FROM _iobeamdb_catalog.hypertable;
id | schema_name | table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_column_name | time_column_type | created_on | chunk_size_bytes
----+-------------+--------------------+------------------------+-------------------------+--------------------+-----------------+----------------------+---------------------+--------------------+-----------+------------------+------------------+------------+------------------
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
(1 row)
\dt "public".*

View File

@ -21,10 +21,13 @@ select setup_meta();
(1 row)
\c Test1
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
CREATE SCHEMA io_test;
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
ALTER DATABASE "Test1" SET search_path = "io_test";
SET search_path = 'io_test';
select setup_main();
setup_main
------------
@ -33,9 +36,9 @@ select setup_main();
\c test2
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
select setup_main();
setup_main
------------
@ -95,7 +98,7 @@ SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
\c Test1
BEGIN;
\COPY "testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
COMMIT;
SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHERE table_name = 'testNs'), 'dev1') part
@ -106,7 +109,7 @@ INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
(1 row)
\c Test1
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257987600000000000, 'dev1', 1.5, 1),
(1257987600000000000, 'dev1', 1.5, 2),
(1257894000000000000, 'dev20', 1.5, 1),
@ -114,7 +117,7 @@ INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
\c test2
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257894000000000000, 'dev20', 1.5, 2);
\c Test1
\c test2
CREATE TABLE chunk_closing_test(
time BIGINT,
metric INTEGER,
@ -145,9 +148,9 @@ SELECT * FROM _iobeamdb_catalog.chunk c
WHERE h.schema_name = 'public' AND h.table_name = 'chunk_closing_test';
id | partition_id | start_time | end_time | chunk_id | partition_replica_id | database_name | schema_name | table_name | id | partition_id | hypertable_id | replica_id | schema_name | table_name | id | schema_name | table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_column_name | time_column_type | created_on | chunk_size_bytes
----+--------------+------------+----------+----------+----------------------+---------------+--------------------+---------------------+----+--------------+---------------+------------+--------------------+------------------------+----+-------------+--------------------+------------------------+-------------------------+--------------------+-----------------+----------------------+---------------------+--------------------+-----------+------------------+------------------+------------+------------------
4 | 3 | | 1 | 4 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_4_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
5 | 3 | 2 | 2 | 5 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_5_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
6 | 3 | 3 | | 6 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_6_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | Test1 | 10000
4 | 3 | | 1 | 4 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_4_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
5 | 3 | 2 | 2 | 5 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_5_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
6 | 3 | 3 | | 6 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_6_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | _iobeamdb_internal | _hyper_2_distinct | 1 | STICKY | time | bigint | test2 | 10000
(3 rows)
\c Test1
@ -244,7 +247,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_partition,
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_1_data')
@ -260,7 +263,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_1_0_2_data')
@ -276,7 +279,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data,
_iobeamdb_internal._hyper_1_1_0_2_data
@ -297,7 +300,7 @@ Indexes:
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_2_0_partition
Table "_iobeamdb_internal._hyper_1_2_0_partition"
@ -310,7 +313,7 @@ Inherits: _iobeamdb_internal._hyper_1_2_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_2_0_3_data
@ -375,7 +378,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_partition,
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_4_data')
@ -388,7 +391,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_5_data')
@ -401,7 +404,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | | plain | |
device_id | text | | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Server: test2
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_2_3_0_6_data')
@ -414,7 +417,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
_iobeamdb_internal._hyper_2_3_0_5_data,
@ -427,7 +430,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Table "_iobeamdb_internal._hyper_2_distinct"
@ -589,7 +592,7 @@ Indexes:
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -609,7 +612,7 @@ Indexes:
"8-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Inherits: _iobeamdb_internal._hyper_1_1_0_partition
@ -623,7 +626,7 @@ Inherits: _iobeamdb_internal._hyper_1_1_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data,
_iobeamdb_internal._hyper_1_1_0_2_data
@ -638,7 +641,7 @@ Child tables: _iobeamdb_internal._hyper_1_1_0_1_data,
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Server: Test1
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_2_0_3_data')
Inherits: _iobeamdb_internal._hyper_1_2_0_partition
@ -653,7 +656,7 @@ Inherits: _iobeamdb_internal._hyper_1_2_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_1_0_replica
Child tables: _iobeamdb_internal._hyper_1_2_0_3_data
@ -725,7 +728,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_partition,
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" <= '1'::bigint)
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
@ -736,7 +739,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint)
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
@ -747,7 +750,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("time" >= '3'::bigint)
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
@ -758,7 +761,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
_iobeamdb_internal._hyper_2_3_0_5_data,
@ -771,7 +774,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
metric | integer | | plain | |
device_id | text | | extended | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: _iobeamdb_internal._hyper_2_0_replica
Table "_iobeamdb_internal._hyper_2_distinct"

View File

@ -244,7 +244,7 @@ Indexes:
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"time_range" CHECK ("timeCustom" <= '1257897600000000000'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
@ -264,7 +264,7 @@ Indexes:
"8-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"time_range" CHECK ("timeCustom" >= '1257897600000000001'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
@ -278,7 +278,7 @@ Inherits: "testNs"._hyper_1_1_0_partition
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_1_0_1_data,
"testNs"._hyper_1_1_0_2_data

View File

@ -4,17 +4,17 @@ psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required ext
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:16: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
LOCATION: CreateExtensionInternal, extension.c:1441
psql:include/create_clustered_db.sql:20: NOTICE: 00000: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
LOCATION: CreateExtensionInternal, extension.c:1441
\c postgres
\! pg_dump -h localhost -U postgres -Fc Test1 > dump/Test1.sql

View File

@ -1,14 +1,14 @@
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
\c Test1
SELECT * FROM "testNs";
SELECT * FROM PUBLIC."testNs";
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------
1257894000000000000 | dev1 | 1.5 | 1 | 2 | t
@ -23,7 +23,7 @@ SELECT * FROM "testNs";
1257894000000000000 | dev20 | 1.5 | 2 | |
(10 rows)
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs";
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs";
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
@ -45,7 +45,7 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs";
\echo "The following queries should NOT scan testNs._hyper_1_1_0_partition"
"The following queries should NOT scan testNs._hyper_1_1_0_partition"
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev20';
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev20';
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
@ -63,7 +63,7 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev20'
Index Cond: (_hyper_1_2_0_3_data.device_id = 'dev20'::text)
(13 rows)
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev'||'20';
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev'||'20';
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append
@ -81,7 +81,7 @@ EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev'||
Index Cond: (_hyper_1_2_0_3_data.device_id = 'dev20'::text)
(13 rows)
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE 'dev'||'20' = device_id;
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE 'dev'||'20' = device_id;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Append

View File

@ -1,12 +1,12 @@
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
\c meta
SELECT add_cluster_user('postgres', NULL);
add_cluster_user
@ -66,7 +66,7 @@ SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
(1 row)
\c Test1
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO PUBLIC."testNs"("timeCustom", device_id, series_0, series_1) VALUES
('2009-11-12T01:00:00+00:00', 'dev1', 1.5, 1),
('2009-11-12T01:00:00+00:00', 'dev1', 1.5, 2),
('2009-11-10T23:00:02+00:00', 'dev1', 2.5, 3);
@ -78,7 +78,7 @@ INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
(1 row)
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO PUBLIC."testNs"("timeCustom", device_id, series_0, series_1) VALUES
('2009-11-10T23:00:00+00:00', 'dev2', 1.5, 1),
('2009-11-10T23:00:00+00:00', 'dev2', 1.5, 2);
SELECT * FROM PUBLIC."testNs";

View File

@ -1,13 +1,13 @@
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:16: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:20: NOTICE: installing required extension "hstore"
\c Test1
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
\c test2
SELECT * FROM "testNs";
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------

View File

@ -13,7 +13,10 @@ CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_meta();
\c Test1
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
CREATE SCHEMA io_test;
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
ALTER DATABASE "Test1" SET search_path = "io_test";
SET search_path = 'io_test';
select setup_main();
\c test2

View File

@ -20,10 +20,10 @@ CREATE INDEX "ind_sensor_1" ON PUBLIC."Hypertable_1" (time, "sensor_1");
SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_1', TRUE);
SELECT set_is_distinct_flag('"public"."Hypertable_1"', 'sensor_2', TRUE);
INSERT INTO "Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
INSERT INTO PUBLIC."Hypertable_1"(time, "Device_id", temp_c, humidity, sensor_1, sensor_2, sensor_3, sensor_4)
VALUES(1257894000000000000, 'dev1', 30, 70, 1, 2, 3, 100);
--expect error cases
\set ON_ERROR_STOP 0
UPDATE ONLY "Hypertable_1" SET time = 0 WHERE TRUE;
DELETE FROM ONLY "Hypertable_1" WHERE "Device_id" = 'dev1';
UPDATE ONLY PUBLIC."Hypertable_1" SET time = 0 WHERE TRUE;
DELETE FROM ONLY PUBLIC."Hypertable_1" WHERE "Device_id" = 'dev1';
\set ON_ERROR_STOP 1

View File

@ -31,7 +31,7 @@ SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
\c Test1
BEGIN;
\COPY "testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
COMMIT;
SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
@ -39,7 +39,7 @@ FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHE
INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
\c Test1
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257987600000000000, 'dev1', 1.5, 1),
(1257987600000000000, 'dev1', 1.5, 2),
(1257894000000000000, 'dev20', 1.5, 1),
@ -50,7 +50,7 @@ INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257894000000000000, 'dev20', 1.5, 2);
\c Test1
\c test2
CREATE TABLE chunk_closing_test(
time BIGINT,
metric INTEGER,

View File

@ -7,14 +7,14 @@
\set ECHO ALL
\c Test1
SELECT * FROM "testNs";
SELECT * FROM PUBLIC."testNs";
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs";
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs";
\echo "The following queries should NOT scan testNs._hyper_1_1_0_partition"
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev20';
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id = 'dev'||'20';
EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE 'dev'||'20' = device_id;
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev20';
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE device_id = 'dev'||'20';
EXPLAIN (verbose ON, costs off) SELECT * FROM PUBLIC."testNs" WHERE 'dev'||'20' = device_id;
--TODO: handle this later?
--EXPLAIN (verbose ON, costs off) SELECT * FROM "testNs" WHERE device_id IN ('dev20', 'dev21');

View File

@ -41,7 +41,7 @@ SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
\c Test1
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO PUBLIC."testNs"("timeCustom", device_id, series_0, series_1) VALUES
('2009-11-12T01:00:00+00:00', 'dev1', 1.5, 1),
('2009-11-12T01:00:00+00:00', 'dev1', 1.5, 2),
('2009-11-10T23:00:02+00:00', 'dev1', 2.5, 3);
@ -50,7 +50,7 @@ SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHERE table_name = 'testNs'), 'dev1') part
INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
INSERT INTO PUBLIC."testNs"("timeCustom", device_id, series_0, series_1) VALUES
('2009-11-10T23:00:00+00:00', 'dev2', 1.5, 1),
('2009-11-10T23:00:00+00:00', 'dev2', 1.5, 2);

View File

@ -5,7 +5,7 @@
\o
\set ECHO ALL
\c Test1
\c test2
SELECT * FROM "testNs";

View File

@ -47,6 +47,7 @@ typedef struct hypertable_info
typedef struct partitioning_info
{
Name partitioning_column;
Name partitioning_func_schema;
Name partitioning_func;
int32 partitioning_mod;
} partitioning_info;
@ -69,7 +70,7 @@ static Node *add_partitioning_func_qual_mutator(Node *node, add_partitioning_fun
static partitioning_info *
get_partitioning_info_for_partition_column_var(Var *var_expr, Query *parse, List * hypertable_info_list);
static Expr *
create_partition_func_equals_const(Var *var_expr, Const *const_expr, Name partitioning_func, int32 partitioning_mod);
create_partition_func_equals_const(Var *var_expr, Const *const_expr, Name partitioning_func_schema, Name partitioning_func, int32 partitioning_mod);
void
_PG_init(void)
@ -238,7 +239,7 @@ get_hypertable_info(Oid mainRelationOid)
for (j = 0; j < total_rows; j++)
{
HeapTuple tuple = SPI_tuptable->vals[j];
Name partitioning_func, partitioning_column;
Name partitioning_func_schema, partitioning_func, partitioning_column;
int32 partitioning_mod;
partitioning_info* info = (partitioning_info *) SPI_palloc(sizeof(partitioning_info));
@ -250,14 +251,20 @@ get_hypertable_info(Oid mainRelationOid)
memcpy(info->partitioning_column, partitioning_column, sizeof(NameData));
}
partitioning_func = DatumGetName(SPI_getbinval(tuple, tupdesc, 3, &isnull));
partitioning_func_schema = DatumGetName(SPI_getbinval(tuple, tupdesc, 3, &isnull));
if (!isnull) {
info->partitioning_func_schema = SPI_palloc(sizeof(NameData));
memcpy(info->partitioning_func_schema, partitioning_func_schema, sizeof(NameData));
}
partitioning_func = DatumGetName(SPI_getbinval(tuple, tupdesc, 4, &isnull));
if (!isnull) {
info->partitioning_func = SPI_palloc(sizeof(NameData));
memcpy(info->partitioning_func, partitioning_func, sizeof(NameData));
}
partitioning_mod = DatumGetInt32(SPI_getbinval(tuple, tupdesc, 4, &isnull));
partitioning_mod = DatumGetInt32(SPI_getbinval(tuple, tupdesc, 5, &isnull));
if (!isnull) {
info->partitioning_mod = partitioning_mod;
@ -360,6 +367,7 @@ add_partitioning_func_qual_mutator(Node *node, add_partitioning_func_qual_contex
&& pi->partitioning_func != NULL) {
/* The var is a partitioning column */
Expr * partitioning_clause = create_partition_func_equals_const(var_expr, const_expr,
pi->partitioning_func_schema,
pi->partitioning_func,
pi->partitioning_mod);
@ -407,10 +415,10 @@ get_partitioning_info_for_partition_column_var(Var *var_expr, Query *parse, List
* This function makes a copy of all nodes given in input.
* */
static Expr *
create_partition_func_equals_const(Var *var_expr, Const *const_expr, Name partitioning_func, int32 partitioning_mod)
create_partition_func_equals_const(Var *var_expr, Const *const_expr, Name partitioning_func_schema, Name partitioning_func, int32 partitioning_mod)
{
Expr *op_expr;
List *func_name = list_make1(makeString(NameStr(*(partitioning_func))));
List *func_name = list_make2(makeString(NameStr(*(partitioning_func_schema))), makeString(NameStr(*(partitioning_func))));
Var *var_for_fn_call;
Const *const_for_fn_call;
Const *mod_const_var_call;

View File

@ -3,7 +3,7 @@
#define HYPERTABLE_INFO_QUERY "\
SELECT format('%%I.%%I', hr.schema_name, hr.table_name)::regclass::oid, \
pe.partitioning_column, pe.partitioning_func, pe.partitioning_mod \
pe.partitioning_column, pe.partitioning_func_schema, pe.partitioning_func, pe.partitioning_mod \
FROM _iobeamdb_catalog.hypertable h \
INNER JOIN _iobeamdb_catalog.default_replica_node drn ON (drn.hypertable_id = h.id AND drn.database_name = current_database()) \
INNER JOIN _iobeamdb_catalog.hypertable_replica hr ON (hr.replica_id = drn.replica_id AND hr.hypertable_id = drn.hypertable_id) \