diff options
author | Tomas Vondra | 2017-04-23 00:15:40 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-04-23 00:15:40 +0000 |
commit | 4c3a3d7cf1f8b1916d9ab8d496ac2896b89e67c1 (patch) | |
tree | 1cfa19761433bbf460ee0f4adc06ff65db98d78f | |
parent | b383b07c941c22ae0bbe9ae28bd1e84e114d821a (diff) |
Resolve failures in the cluster regression suite
Distributing tables in this particular test suite does not make
much sense. Firstly, the tables would need to be more complex
to work around 'could not plan distributed update' errors. But
more importantly, we would have ho use ORDER BY to make the
query results stable, which defeats the intent, i.e. testing
that the table is sorted on disk. So just use replicated tables.
Also fix name of the user used in the regression tests.
-rw-r--r-- | src/test/regress/expected/cluster.out | 17 | ||||
-rw-r--r-- | src/test/regress/sql/cluster.sql | 16 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index 0113d648f9..8a4c38dbeb 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -380,7 +380,7 @@ ORDER BY 1; -- Test MVCC-safety of cluster. There isn't much we can do to verify the -- results with a single backend... -CREATE TABLE clustertest (key int PRIMARY KEY); +CREATE TABLE clustertest (key int PRIMARY KEY) DISTRIBUTE BY REPLICATION; INSERT INTO clustertest VALUES (10); INSERT INTO clustertest VALUES (20); INSERT INTO clustertest VALUES (30); @@ -396,18 +396,18 @@ UPDATE clustertest SET key = 35 WHERE key = 40; UPDATE clustertest SET key = 60 WHERE key = 50; UPDATE clustertest SET key = 70 WHERE key = 60; UPDATE clustertest SET key = 80 WHERE key = 70; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; key ----- 20 30 + 100 35 80 - 100 (5 rows) CLUSTER clustertest_pkey ON clustertest; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; key ----- 20 @@ -418,7 +418,7 @@ SELECT * FROM clustertest ORDER BY 1; (5 rows) COMMIT; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; key ----- 20 @@ -429,7 +429,10 @@ SELECT * FROM clustertest ORDER BY 1; (5 rows) -- check that temp tables can be clustered -create temp table clstr_temp (col1 int primary key, col2 text); +-- Enforce use of COMMIT instead of 2PC for temporary objects +RESET SESSION AUTHORIZATION; +SET SESSION AUTHORIZATION regress_clstr_user; +create temp table clstr_temp (col1 int primary key, col2 text) DISTRIBUTE BY REPLICATION; insert into clstr_temp values (2, 'two'), (1, 'one'); cluster clstr_temp using clstr_temp_pkey; select * from clstr_temp; @@ -442,7 +445,7 @@ select * from clstr_temp; drop table clstr_temp; RESET SESSION AUTHORIZATION; -- Test CLUSTER with external tuplesorting -create table clstr_4 as select * from tenk1; +create table clstr_4 distribute by replication as select * from tenk1; create index cluster_sort on clstr_4 (hundred, thousand, tenthous); -- ensure we don't use the index in CLUSTER nor the checking SELECTs set enable_indexscan = off; diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql index 098089bd8d..8c12be2253 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -161,7 +161,7 @@ ORDER BY 1; -- Test MVCC-safety of cluster. There isn't much we can do to verify the -- results with a single backend... -CREATE TABLE clustertest (key int PRIMARY KEY); +CREATE TABLE clustertest (key int PRIMARY KEY) DISTRIBUTE BY REPLICATION; INSERT INTO clustertest VALUES (10); INSERT INTO clustertest VALUES (20); @@ -183,30 +183,30 @@ UPDATE clustertest SET key = 60 WHERE key = 50; UPDATE clustertest SET key = 70 WHERE key = 60; UPDATE clustertest SET key = 80 WHERE key = 70; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; CLUSTER clustertest_pkey ON clustertest; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; COMMIT; -SELECT * FROM clustertest ORDER BY 1; +SELECT * FROM clustertest; -- check that temp tables can be clustered -- Enforce use of COMMIT instead of 2PC for temporary objects RESET SESSION AUTHORIZATION; -SET SESSION AUTHORIZATION clstr_user; +SET SESSION AUTHORIZATION regress_clstr_user; -create temp table clstr_temp (col1 int primary key, col2 text); +create temp table clstr_temp (col1 int primary key, col2 text) DISTRIBUTE BY REPLICATION; insert into clstr_temp values (2, 'two'), (1, 'one'); cluster clstr_temp using clstr_temp_pkey; -select * from clstr_temp order by 1; +select * from clstr_temp; drop table clstr_temp; RESET SESSION AUTHORIZATION; -- Test CLUSTER with external tuplesorting -create table clstr_4 as select * from tenk1; +create table clstr_4 distribute by replication as select * from tenk1; create index cluster_sort on clstr_4 (hundred, thousand, tenthous); -- ensure we don't use the index in CLUSTER nor the checking SELECTs set enable_indexscan = off; |