Add some more tests

pull/472/head
Brian Cloutier 2016-04-28 03:48:42 -07:00
parent 8b43ce8b7c
commit 693a797896
2 changed files with 26 additions and 0 deletions

View File

@ -317,8 +317,24 @@ WITH deleted_orders AS (INSERT INTO limit_orders DEFAULT VALUES RETURNING *)
UPDATE limit_orders SET symbol = 'GM';
ERROR: cannot perform distributed planning for the given modification
DETAIL: Common table expressions are not supported in distributed modifications.
SELECT symbol, bidder_id FROM limit_orders WHERE id = 246;
symbol | bidder_id
--------+-----------
GM | 18
(1 row)
-- updates referencing just a var are supported
UPDATE limit_orders SET bidder_id = id WHERE id = 246;
-- updates referencing a column are supported
UPDATE limit_orders SET bidder_id = bidder_id + 1 WHERE id = 246;
-- pure functions are allowed
UPDATE limit_orders SET symbol = LOWER(symbol) WHERE id = 246;
SELECT symbol, bidder_id FROM limit_orders WHERE id = 246;
symbol | bidder_id
--------+-----------
gm | 247
(1 row)
-- updates referencing an unpure function are unsupported
UPDATE limit_orders SET placed_at = now() WHERE id = 246;
ERROR: cannot plan sharded modification containing values which are not constants or constant expressions

View File

@ -235,9 +235,19 @@ UPDATE limit_orders SET symbol = 'GM' WHERE id = 246 RETURNING *;
WITH deleted_orders AS (INSERT INTO limit_orders DEFAULT VALUES RETURNING *)
UPDATE limit_orders SET symbol = 'GM';
SELECT symbol, bidder_id FROM limit_orders WHERE id = 246;
-- updates referencing just a var are supported
UPDATE limit_orders SET bidder_id = id WHERE id = 246;
-- updates referencing a column are supported
UPDATE limit_orders SET bidder_id = bidder_id + 1 WHERE id = 246;
-- pure functions are allowed
UPDATE limit_orders SET symbol = LOWER(symbol) WHERE id = 246;
SELECT symbol, bidder_id FROM limit_orders WHERE id = 246;
-- updates referencing an unpure function are unsupported
UPDATE limit_orders SET placed_at = now() WHERE id = 246;