From 41261e4e58d1e95bf55176c4c6ae24154d78ce38 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Wed, 23 Jun 2021 17:20:52 +0200 Subject: [PATCH] Stabilize timestamp_limits test output Remove the chunk name completely from output as the name might have different length leading to different output as table headers are adjusted to the length of the field values. --- tsl/test/shared/expected/timestamp_limits.out | 40 +++++++------------ tsl/test/shared/sql/timestamp_limits.sql | 24 +++++------ 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/tsl/test/shared/expected/timestamp_limits.out b/tsl/test/shared/expected/timestamp_limits.out index 5291bd9bf..ed4043150 100644 --- a/tsl/test/shared/expected/timestamp_limits.out +++ b/tsl/test/shared/expected/timestamp_limits.out @@ -109,15 +109,13 @@ NOTICE: adding not-null constraint to column "time" table_name | smallint_table INSERT INTO smallint_table VALUES (-32768), (32767); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('smallint_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; --[ RECORD 1 ]--------+----------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk +AND c.contype = 'c' ORDER BY chunk; +-[ RECORD 1 ]--------+-------------------------------------- pg_get_constraintdef | CHECK (("time" < '-32760'::smallint)) --[ RECORD 2 ]--------+----------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk +-[ RECORD 2 ]--------+-------------------------------------- pg_get_constraintdef | CHECK (("time" >= '32760'::smallint)) CREATE TABLE int_table(time int); @@ -127,15 +125,13 @@ NOTICE: adding not-null constraint to column "time" table_name | int_table INSERT INTO int_table VALUES (-2147483648), (2147483647); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('int_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; -[ RECORD 1 ]--------+------------------------------------------ -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" < '-2147483640'::integer)) -[ RECORD 2 ]--------+------------------------------------------ -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" >= 2147483640)) CREATE TABLE bigint_table(time bigint); @@ -145,15 +141,13 @@ NOTICE: adding not-null constraint to column "time" table_name | bigint_table INSERT INTO bigint_table VALUES (-9223372036854775808), (9223372036854775807); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('bigint_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; -[ RECORD 1 ]--------+-------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" < '-9223372036854775800'::bigint)) -[ RECORD 2 ]--------+-------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" >= '9223372036854775800'::bigint)) CREATE TABLE date_table(time date); @@ -170,15 +164,13 @@ ERROR: timestamp out of range INSERT INTO date_table VALUES (test.end_ts_date()); ERROR: timestamp out of range \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('date_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; -[ RECORD 1 ]--------+----------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" < '4714-11-27 BC'::date)) -[ RECORD 2 ]--------+----------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" >= '294246-12-31'::date)) CREATE TABLE timestamp_table(time timestamp); @@ -196,15 +188,13 @@ ERROR: timestamp out of range INSERT INTO timestamp_table VALUES (test.end_ts_timestamp()); ERROR: timestamp out of range \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('timestamp_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; -[ RECORD 1 ]--------+------------------------------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" < '4714-11-27 00:00:00 BC'::timestamp without time zone)) -[ RECORD 2 ]--------+------------------------------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" >= '294246-12-31 00:00:00'::timestamp without time zone)) CREATE TABLE timestamptz_table(time timestamp); @@ -223,15 +213,13 @@ ERROR: timestamp out of range INSERT INTO timestamptz_table VALUES (test.end_ts_timestamptz()); ERROR: timestamp out of range \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('timestamptz_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; -[ RECORD 1 ]--------+------------------------------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" < '4714-11-27 00:00:00 BC'::timestamp without time zone)) -[ RECORD 2 ]--------+------------------------------------------------------------------------- -chunk | _timescaledb_internal._hyper_X_X_chunk pg_get_constraintdef | CHECK (("time" >= '294246-12-31 00:00:00'::timestamp without time zone)) RESET datestyle; diff --git a/tsl/test/shared/sql/timestamp_limits.sql b/tsl/test/shared/sql/timestamp_limits.sql index 702fda36e..7c2b6b197 100644 --- a/tsl/test/shared/sql/timestamp_limits.sql +++ b/tsl/test/shared/sql/timestamp_limits.sql @@ -106,28 +106,28 @@ CREATE TABLE smallint_table(time smallint); SELECT table_name FROM create_hypertable('smallint_table', 'time', chunk_time_interval=>10); INSERT INTO smallint_table VALUES (-32768), (32767); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('smallint_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; CREATE TABLE int_table(time int); SELECT table_name FROM create_hypertable('int_table', 'time', chunk_time_interval=>10); INSERT INTO int_table VALUES (-2147483648), (2147483647); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('int_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; CREATE TABLE bigint_table(time bigint); SELECT table_name FROM create_hypertable('bigint_table', 'time', chunk_time_interval=>10); INSERT INTO bigint_table VALUES (-9223372036854775808), (9223372036854775807); -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('bigint_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; CREATE TABLE date_table(time date); SELECT table_name FROM create_hypertable('date_table', 'time'); @@ -138,10 +138,10 @@ INSERT INTO date_table VALUES (test.min_ts_date() - INTERVAL '1 day'); INSERT INTO date_table VALUES (test.end_ts_date()); \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('date_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; CREATE TABLE timestamp_table(time timestamp); SELECT table_name FROM create_hypertable('timestamp_table', 'time'); @@ -155,10 +155,10 @@ INSERT INTO timestamp_table VALUES (test.min_ts_timestamp() - INTERVAL '1 micros INSERT INTO timestamp_table VALUES (test.end_ts_timestamp()); \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('timestamp_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; CREATE TABLE timestamptz_table(time timestamp); SELECT table_name FROM create_hypertable('timestamptz_table', 'time'); @@ -173,10 +173,10 @@ INSERT INTO timestamptz_table VALUES (test.min_ts_timestamptz() - INTERVAL '1 mi INSERT INTO timestamptz_table VALUES (test.end_ts_timestamptz()); \set ON_ERROR_STOP 1 -SELECT chunk, pg_get_constraintdef(c.oid) +SELECT pg_get_constraintdef(c.oid) FROM show_chunks('timestamptz_table') chunk, pg_constraint c WHERE c.conrelid = chunk -AND c.contype = 'c' ORDER BY 1; +AND c.contype = 'c' ORDER BY chunk; RESET datestyle; RESET timezone;