Skip to content

Commit

Permalink
Add a test for citus_shards where table names have spaces
Browse files Browse the repository at this point in the history
There was a bug reported for previous versions of Citus where
shard_size was returning NULL for tables with spaces in them. It works
fine on the main branch though, but I'm still adding a test for this to
the main branch because it seems a good test to have.
  • Loading branch information
JelteF committed Sep 25, 2023
1 parent a9d28ca commit 3f13b4f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/test/regress/citus_tests/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def extra_tests(self):
worker_count=6,
),
"function_propagation": TestDeps("minimal_schedule"),
"citus_shards": TestDeps("minimal_schedule"),
"grant_on_foreign_server_propagation": TestDeps("minimal_schedule"),
"multi_mx_modifying_xacts": TestDeps(None, ["multi_mx_create_table"]),
"multi_mx_router_planner": TestDeps(None, ["multi_mx_create_table"]),
Expand Down
8 changes: 8 additions & 0 deletions src/test/regress/expected/citus_shards.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE SCHEMA citus_shards;
SET search_path TO citus_shards;
SET citus.shard_count TO 4;
SET citus.shard_replication_factor TO 1;
SET citus.next_shard_id TO 99456900;
-- add tests here
SET client_min_messages TO WARNING;
DROP SCHEMA citus_shards CASCADE;
2 changes: 2 additions & 0 deletions src/test/regress/multi_1_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ test: multi_read_from_secondaries
test: grant_on_database_propagation
test: alter_database_propagation

test: citus_shards

# ----------
# multi_citus_tools tests utility functions written for citus tools
# ----------
Expand Down
16 changes: 16 additions & 0 deletions src/test/regress/sql/citus_shards.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE SCHEMA citus_shards;
SET search_path TO citus_shards;
SET citus.shard_count TO 4;
SET citus.shard_replication_factor TO 1;
SET citus.next_shard_id TO 99456900;

CREATE TABLE t1 (i int);
SELECT create_distributed_table('t1', 'i');
CREATE TABLE "t with space" (i int);
SELECT create_distributed_table('"t with space"', 'i');
INSERT INTO t1 SELECT generate_series(1, 100);
INSERT INTO "t with space" SELECT generate_series(1, 1000);
SELECT * FROM citus_shards;

SET client_min_messages TO WARNING;
DROP SCHEMA citus_shards CASCADE;

0 comments on commit 3f13b4f

Please sign in to comment.