-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json test: add tests for element value
- Loading branch information
Showing
12 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
INSERT INTO fruits VALUES (1, '[true]'); | ||
INSERT INTO fruits VALUES (2, '[false]'); | ||
INSERT INTO fruits VALUES (3, '[true]'); | ||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'boolean == true' | ||
ORDER BY id; | ||
id | items | ||
----+-------- | ||
1 | [true] | ||
3 | [true] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
INSERT INTO fruits VALUES (1, '[true]'); | ||
INSERT INTO fruits VALUES (2, '[false]'); | ||
INSERT INTO fruits VALUES (3, '[true]'); | ||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'boolean == true' | ||
ORDER BY id; | ||
id | items | ||
----+-------- | ||
1 | [true] | ||
3 | [true] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
INSERT INTO fruits VALUES (1, '[100]'); | ||
INSERT INTO fruits VALUES (2, '[200, 30]'); | ||
INSERT INTO fruits VALUES (3, '[150]'); | ||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'number <= 100' | ||
ORDER BY id; | ||
id | items | ||
----+----------- | ||
1 | [100] | ||
2 | [200, 30] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
INSERT INTO fruits VALUES (1, '[100]'); | ||
INSERT INTO fruits VALUES (2, '[200, 30]'); | ||
INSERT INTO fruits VALUES (3, '[150]'); | ||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'number <= 100' | ||
ORDER BY id; | ||
id | items | ||
----+----------- | ||
1 | [100] | ||
2 | [200, 30] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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); | ||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'string == "apple"' | ||
ORDER BY id; | ||
id | items | ||
----+--------------------- | ||
1 | ["apple"] | ||
2 | ["banana", "apple"] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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); | ||
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 | ||
----+--------------------- | ||
1 | ["apple"] | ||
2 | ["banana", "apple"] | ||
(2 rows) | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
|
||
INSERT INTO fruits VALUES (1, '[true]'); | ||
INSERT INTO fruits VALUES (2, '[false]'); | ||
INSERT INTO fruits VALUES (3, '[true]'); | ||
|
||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
|
||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'boolean == true' | ||
ORDER BY id; | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
|
||
INSERT INTO fruits VALUES (1, '[true]'); | ||
INSERT INTO fruits VALUES (2, '[false]'); | ||
INSERT INTO fruits VALUES (3, '[true]'); | ||
|
||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
|
||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'boolean == true' | ||
ORDER BY id; | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
|
||
INSERT INTO fruits VALUES (1, '[100]'); | ||
INSERT INTO fruits VALUES (2, '[200, 30]'); | ||
INSERT INTO fruits VALUES (3, '[150]'); | ||
|
||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
|
||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'number <= 100' | ||
ORDER BY id; | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CREATE TABLE fruits ( | ||
id int, | ||
items jsonb | ||
); | ||
|
||
INSERT INTO fruits VALUES (1, '[100]'); | ||
INSERT INTO fruits VALUES (2, '[200, 30]'); | ||
INSERT INTO fruits VALUES (3, '[150]'); | ||
|
||
CREATE INDEX pgroonga_index ON fruits USING pgroonga (items); | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = on; | ||
SET enable_bitmapscan = off; | ||
|
||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'number <= 100' | ||
ORDER BY id; | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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); | ||
|
||
SET enable_seqscan = off; | ||
SET enable_indexscan = off; | ||
SET enable_bitmapscan = on; | ||
|
||
SELECT id, items | ||
FROM fruits | ||
WHERE items @@ 'string == "apple"' | ||
ORDER BY id; | ||
|
||
DROP TABLE fruits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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); | ||
|
||
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; |