mirror of https://github.com/citusdata/citus.git
Add order by multi_shard_update_delete
parent
6a8e2c260a
commit
298e95c441
|
@ -106,10 +106,12 @@ INSERT INTO users_test_table (user_id, value_3) VALUES(16,1), (20,16), (7,1), (2
|
||||||
SET citus.multi_shard_modify_mode to sequential;
|
SET citus.multi_shard_modify_mode to sequential;
|
||||||
UPDATE users_test_table SET value_3 = 1;
|
UPDATE users_test_table SET value_3 = 1;
|
||||||
END;
|
END;
|
||||||
SELECT COUNT()SUM(value_3) FROM users_test_table;
|
SELECT SUM(value_3) FROM users_test_table;
|
||||||
ERROR: syntax error at or near "("
|
sum
|
||||||
LINE 1: SELECT COUNT()SUM(value_3) FROM users_test_table;
|
-----
|
||||||
^
|
16
|
||||||
|
(1 row)
|
||||||
|
|
||||||
SET citus.multi_shard_modify_mode to 'sequential';
|
SET citus.multi_shard_modify_mode to 'sequential';
|
||||||
-- Run multiple multi shard updates (with sequential executor)
|
-- Run multiple multi shard updates (with sequential executor)
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
@ -205,15 +207,15 @@ SELECT * FROM master_append_table_to_shard(1440011, 'append_stage_table_2', 'loc
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
UPDATE test_append_table SET col_2 = 5;
|
UPDATE test_append_table SET col_2 = 5;
|
||||||
SELECT * FROM test_append_table;
|
SELECT * FROM test_append_table ORDER BY 1 DESC, 2 DESC;
|
||||||
id | col_2
|
id | col_2
|
||||||
----+-------
|
----+-------
|
||||||
8 | 5
|
|
||||||
9 | 5
|
|
||||||
10 | 5
|
10 | 5
|
||||||
1 | 5
|
9 | 5
|
||||||
3 | 5
|
8 | 5
|
||||||
5 | 5
|
5 | 5
|
||||||
|
3 | 5
|
||||||
|
1 | 5
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
DROP TABLE append_stage_table;
|
DROP TABLE append_stage_table;
|
||||||
|
@ -235,7 +237,7 @@ NOTICE: Copying data from local table...
|
||||||
|
|
||||||
UPDATE tt1 SET col_2 = 13;
|
UPDATE tt1 SET col_2 = 13;
|
||||||
DELETE FROM tt1 WHERE id = 1 or id = 3 or id = 5;
|
DELETE FROM tt1 WHERE id = 1 or id = 3 or id = 5;
|
||||||
SELECT * FROM tt1;
|
SELECT * FROM tt1 ORDER BY 1 DESC, 2 DESC;
|
||||||
id | col_2
|
id | col_2
|
||||||
----+-------
|
----+-------
|
||||||
8 | 13
|
8 | 13
|
||||||
|
@ -743,11 +745,12 @@ ERROR: cannot push down this subquery
|
||||||
DETAIL: Shards of relations in subquery need to have 1-to-1 shard partitioning
|
DETAIL: Shards of relations in subquery need to have 1-to-1 shard partitioning
|
||||||
-- Should error out due to multiple row return from subquery, but we can not get this information within
|
-- Should error out due to multiple row return from subquery, but we can not get this information within
|
||||||
-- subquery pushdown planner. This query will be sent to worker with recursive planner.
|
-- subquery pushdown planner. This query will be sent to worker with recursive planner.
|
||||||
|
\set VERBOSITY terse
|
||||||
DELETE FROM users_test_table
|
DELETE FROM users_test_table
|
||||||
WHERE users_test_table.user_id = (SELECT user_id
|
WHERE users_test_table.user_id = (SELECT user_id
|
||||||
FROM events_test_table);
|
FROM events_test_table);
|
||||||
ERROR: more than one row returned by a subquery used as an expression
|
ERROR: more than one row returned by a subquery used as an expression
|
||||||
CONTEXT: while executing command on localhost:57637
|
\set VERBOSITY default
|
||||||
-- Cursors are not supported
|
-- Cursors are not supported
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table ORDER BY user_id;
|
DECLARE test_cursor CURSOR FOR SELECT * FROM users_test_table ORDER BY user_id;
|
||||||
|
@ -761,12 +764,12 @@ UPDATE users_test_table SET value_2 = 5 WHERE CURRENT OF test_cursor;
|
||||||
ERROR: cannot run DML queries with cursors
|
ERROR: cannot run DML queries with cursors
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
-- Stable functions are supported
|
-- Stable functions are supported
|
||||||
SELECT * FROM test_table_1;
|
SELECT * FROM test_table_1 ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
id | date_col | col_3
|
id | date_col | col_3
|
||||||
----+------------------------------+-------
|
----+------------------------------+-------
|
||||||
1 | Sat Apr 05 08:32:12 2014 PDT | 5
|
|
||||||
3 | Mon Jan 12 08:35:19 2111 PST | 9
|
3 | Mon Jan 12 08:35:19 2111 PST | 9
|
||||||
2 | Sun Feb 01 08:31:16 2015 PST | 7
|
2 | Sun Feb 01 08:31:16 2015 PST | 7
|
||||||
|
1 | Sat Apr 05 08:32:12 2014 PDT | 5
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
UPDATE test_table_1 SET col_3 = 3 WHERE date_col < now();
|
UPDATE test_table_1 SET col_3 = 3 WHERE date_col < now();
|
||||||
|
|
|
@ -90,7 +90,7 @@ INSERT INTO users_test_table (user_id, value_3) VALUES(16,1), (20,16), (7,1), (2
|
||||||
SET citus.multi_shard_modify_mode to sequential;
|
SET citus.multi_shard_modify_mode to sequential;
|
||||||
UPDATE users_test_table SET value_3 = 1;
|
UPDATE users_test_table SET value_3 = 1;
|
||||||
END;
|
END;
|
||||||
SELECT COUNT()SUM(value_3) FROM users_test_table;
|
SELECT SUM(value_3) FROM users_test_table;
|
||||||
|
|
||||||
SET citus.multi_shard_modify_mode to 'sequential';
|
SET citus.multi_shard_modify_mode to 'sequential';
|
||||||
-- Run multiple multi shard updates (with sequential executor)
|
-- Run multiple multi shard updates (with sequential executor)
|
||||||
|
@ -147,7 +147,7 @@ SELECT * FROM master_append_table_to_shard(1440010, 'append_stage_table', 'local
|
||||||
SELECT master_create_empty_shard('test_append_table') AS new_shard_id;
|
SELECT master_create_empty_shard('test_append_table') AS new_shard_id;
|
||||||
SELECT * FROM master_append_table_to_shard(1440011, 'append_stage_table_2', 'localhost', :master_port);
|
SELECT * FROM master_append_table_to_shard(1440011, 'append_stage_table_2', 'localhost', :master_port);
|
||||||
UPDATE test_append_table SET col_2 = 5;
|
UPDATE test_append_table SET col_2 = 5;
|
||||||
SELECT * FROM test_append_table;
|
SELECT * FROM test_append_table ORDER BY 1 DESC, 2 DESC;
|
||||||
|
|
||||||
DROP TABLE append_stage_table;
|
DROP TABLE append_stage_table;
|
||||||
DROP TABLE append_stage_table_2;
|
DROP TABLE append_stage_table_2;
|
||||||
|
@ -163,7 +163,7 @@ INSERT INTO tt1 VALUES (1,11), (3,15), (5,17), (6,19), (8,17), (2,12);
|
||||||
SELECT create_distributed_table('tt1','id');
|
SELECT create_distributed_table('tt1','id');
|
||||||
UPDATE tt1 SET col_2 = 13;
|
UPDATE tt1 SET col_2 = 13;
|
||||||
DELETE FROM tt1 WHERE id = 1 or id = 3 or id = 5;
|
DELETE FROM tt1 WHERE id = 1 or id = 3 or id = 5;
|
||||||
SELECT * FROM tt1;
|
SELECT * FROM tt1 ORDER BY 1 DESC, 2 DESC;
|
||||||
|
|
||||||
-- Partitioned distributed table within transaction
|
-- Partitioned distributed table within transaction
|
||||||
INSERT INTO tt1 VALUES(4,6);
|
INSERT INTO tt1 VALUES(4,6);
|
||||||
|
@ -628,9 +628,11 @@ WHERE users_test_table.user_id = events_test_table_2.user_id;
|
||||||
|
|
||||||
-- Should error out due to multiple row return from subquery, but we can not get this information within
|
-- Should error out due to multiple row return from subquery, but we can not get this information within
|
||||||
-- subquery pushdown planner. This query will be sent to worker with recursive planner.
|
-- subquery pushdown planner. This query will be sent to worker with recursive planner.
|
||||||
|
\set VERBOSITY terse
|
||||||
DELETE FROM users_test_table
|
DELETE FROM users_test_table
|
||||||
WHERE users_test_table.user_id = (SELECT user_id
|
WHERE users_test_table.user_id = (SELECT user_id
|
||||||
FROM events_test_table);
|
FROM events_test_table);
|
||||||
|
\set VERBOSITY default
|
||||||
|
|
||||||
-- Cursors are not supported
|
-- Cursors are not supported
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
@ -640,7 +642,7 @@ UPDATE users_test_table SET value_2 = 5 WHERE CURRENT OF test_cursor;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
-- Stable functions are supported
|
-- Stable functions are supported
|
||||||
SELECT * FROM test_table_1;
|
SELECT * FROM test_table_1 ORDER BY 1 DESC, 2 DESC, 3 DESC;
|
||||||
UPDATE test_table_1 SET col_3 = 3 WHERE date_col < now();
|
UPDATE test_table_1 SET col_3 = 3 WHERE date_col < now();
|
||||||
SELECT * FROM test_table_1;
|
SELECT * FROM test_table_1;
|
||||||
DELETE FROM test_table_1 WHERE date_col < current_timestamp;
|
DELETE FROM test_table_1 WHERE date_col < current_timestamp;
|
||||||
|
|
Loading…
Reference in New Issue