mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
amcheck: Add a test with GIN index on JSONB data
Extend the existing test of GIN checks to also include an index on JSONB data, using the jsonb_path_ops opclass. This is a common enough usage of GIN that it makes sense to have better test coverage for it. Author: Mark Dilger <mark.dilger@enterprisedb.com> Reviewed-By: Tomas Vondra <tomas.vondra@enterprisedb.com> Reviewed-By: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://postgr.es/m/BC221A56-977C-418E-A1B8-9EFC881D80C5%40enterprisedb.com
This commit is contained in:
@ -62,3 +62,17 @@ SELECT gin_index_check('gin_check_text_array_idx');
|
|||||||
|
|
||||||
-- cleanup
|
-- cleanup
|
||||||
DROP TABLE gin_check_text_array;
|
DROP TABLE gin_check_text_array;
|
||||||
|
-- Test GIN over jsonb
|
||||||
|
CREATE TABLE "gin_check_jsonb"("j" jsonb);
|
||||||
|
INSERT INTO gin_check_jsonb values ('{"a":[["b",{"x":1}],["b",{"x":2}]],"c":3}');
|
||||||
|
INSERT INTO gin_check_jsonb values ('[[14,2,3]]');
|
||||||
|
INSERT INTO gin_check_jsonb values ('[1,[14,2,3]]');
|
||||||
|
CREATE INDEX "gin_check_jsonb_idx" on gin_check_jsonb USING GIN("j" jsonb_path_ops);
|
||||||
|
SELECT gin_index_check('gin_check_jsonb_idx');
|
||||||
|
gin_index_check
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- cleanup
|
||||||
|
DROP TABLE gin_check_jsonb;
|
||||||
|
@ -38,3 +38,15 @@ SELECT gin_index_check('gin_check_text_array_idx');
|
|||||||
|
|
||||||
-- cleanup
|
-- cleanup
|
||||||
DROP TABLE gin_check_text_array;
|
DROP TABLE gin_check_text_array;
|
||||||
|
|
||||||
|
-- Test GIN over jsonb
|
||||||
|
CREATE TABLE "gin_check_jsonb"("j" jsonb);
|
||||||
|
INSERT INTO gin_check_jsonb values ('{"a":[["b",{"x":1}],["b",{"x":2}]],"c":3}');
|
||||||
|
INSERT INTO gin_check_jsonb values ('[[14,2,3]]');
|
||||||
|
INSERT INTO gin_check_jsonb values ('[1,[14,2,3]]');
|
||||||
|
CREATE INDEX "gin_check_jsonb_idx" on gin_check_jsonb USING GIN("j" jsonb_path_ops);
|
||||||
|
|
||||||
|
SELECT gin_index_check('gin_check_jsonb_idx');
|
||||||
|
|
||||||
|
-- cleanup
|
||||||
|
DROP TABLE gin_check_jsonb;
|
||||||
|
Reference in New Issue
Block a user