Kouhei Sutou
null+****@clear*****
Sat Sep 26 19:29:04 JST 2015
Kouhei Sutou 2015-09-26 19:29:04 +0900 (Sat, 26 Sep 2015) New Revision: 5c26317bd124d43f0ea8b218cb6dfb3db5de31f7 https://github.com/pgroonga/pgroonga/commit/5c26317bd124d43f0ea8b218cb6dfb3db5de31f7 Message: test: add a test for removing a value Added files: expected/jsonb/delete/multiple-values.out sql/jsonb/delete/multiple-values.sql Added: expected/jsonb/delete/multiple-values.out (+23 -0) 100644 =================================================================== --- /dev/null +++ expected/jsonb/delete/multiple-values.out 2015-09-26 19:29:04 +0900 (13e048b) @@ -0,0 +1,23 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +DELETE FROM fruits WHERE id = 1; +VACUUM; +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + id | items +----+--------------------- + 2 | ["banana", "apple"] +(1 row) + +DROP TABLE fruits; Added: sql/jsonb/delete/multiple-values.sql (+23 -0) 100644 =================================================================== --- /dev/null +++ sql/jsonb/delete/multiple-values.sql 2015-09-26 19:29:04 +0900 (3e84bef) @@ -0,0 +1,23 @@ +CREATE TABLE fruits ( + id int, + items jsonb +); + +INSERT INTO fruits VALUES (1, '["apple"]'); +INSERT INTO fruits VALUES (2, '["banana", "apple"]'); +INSERT INTO fruits VALUES (3, '["peach"]'); + +CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); +DELETE FROM fruits WHERE id = 1; +VACUUM; + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, items + FROM fruits + WHERE items @@ 'string == "apple"' + ORDER BY id; + +DROP TABLE fruits; -------------- next part -------------- HTML����������������������������...Download