From 6e690cbdae08ca7994ffc5766b6208cc947c3aae Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Mon, 5 Jan 2015 13:39:15 +0200 Subject: [PATCH] Add unit test for distributed tables This commit aims to add a unit test for executing queries on distributed tables. Test aims to get the error message when there are no shards created for the distributed tables. --- expected/queries.out | 5 +++++ sql/queries.sql | 3 +++ 2 files changed, 8 insertions(+) diff --git a/expected/queries.out b/expected/queries.out index f96bc14..1792371 100644 --- a/expected/queries.out +++ b/expected/queries.out @@ -13,6 +13,11 @@ SELECT master_create_distributed_table('articles', 'author_id'); (1 row) +-- test when a table is distributed but no shards created yet +SELECT count(*) from articles; +ERROR: cannot plan SELECT query +DETAIL: There are no existing shards for the distributed table. +HINT: Run "master_create_worker_shards" to create shards for the distributed table. \set VERBOSITY terse SELECT master_create_worker_shards('articles', 2, 1); WARNING: Connection failed to adeadhost:5432 diff --git a/sql/queries.sql b/sql/queries.sql index bb1a8b6..4254b62 100644 --- a/sql/queries.sql +++ b/sql/queries.sql @@ -11,6 +11,9 @@ CREATE TABLE articles ( SELECT master_create_distributed_table('articles', 'author_id'); +-- test when a table is distributed but no shards created yet +SELECT count(*) from articles; + \set VERBOSITY terse SELECT master_create_worker_shards('articles', 2, 1); \set VERBOSITY default