Skip to content

Commit

Permalink
Add zero-shard UPDATE/DELETE test
Browse files Browse the repository at this point in the history
For completeness. They work now and result in a no-op.
  • Loading branch information
jasonmp85 committed Feb 27, 2015
1 parent 4f4af5b commit 9540764
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion expected/queries.out
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ INSERT INTO articles VALUES (47, 7, 'abeyance', 1772);
INSERT INTO articles VALUES (48, 8, 'alkylic', 18610);
INSERT INTO articles VALUES (49, 9, 'anyone', 2681);
INSERT INTO articles VALUES (50, 10, 'anjanette', 19519);
-- first, test zero-shard query
-- first, test zero-shard SELECT, which should return zero rows
SELECT COUNT(*) FROM articles WHERE author_id = 1 AND author_id = 2;
count
-------
0
(1 row)

-- zero-shard modifications should be no-ops but not fail
UPDATE articles SET title = '' WHERE author_id = 1 AND author_id = 2;
DELETE FROM articles WHERE author_id = 1 AND author_id = 2;
-- single-shard tests
-- test simple select for a single row
SELECT * FROM articles WHERE author_id = 10 AND id = 50;
Expand Down
6 changes: 5 additions & 1 deletion sql/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ INSERT INTO articles VALUES (48, 8, 'alkylic', 18610);
INSERT INTO articles VALUES (49, 9, 'anyone', 2681);
INSERT INTO articles VALUES (50, 10, 'anjanette', 19519);

-- first, test zero-shard query
-- first, test zero-shard SELECT, which should return zero rows
SELECT COUNT(*) FROM articles WHERE author_id = 1 AND author_id = 2;

-- zero-shard modifications should be no-ops but not fail
UPDATE articles SET title = '' WHERE author_id = 1 AND author_id = 2;
DELETE FROM articles WHERE author_id = 1 AND author_id = 2;

-- single-shard tests

-- test simple select for a single row
Expand Down

0 comments on commit 9540764

Please sign in to comment.