Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a2386a4

Browse files
NikitOS94NikitOS94
NikitOS94
authored and
NikitOS94
committed
1.0.1 Version
1 parent b70cf0f commit a2386a4

12 files changed

+1878
-15
lines changed

META.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "JsQuery",
33
"abstract": "JSON Query Language with GIN indexing support",
44
"description": "JsQuery provides additional functionality for JSONB, such as a simple and effective way to search in nested objects and arrays, and more comparison operators with index support. It does this by implementing a specialized search syntax, the @@ operator, and the jsquery type for search strings.",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"maintainer": [
77
"Teodor Sigaev <teodor@sigaev.ru>",
88
"Alexander Korotkov <aekorotkov@gmail.com>",
@@ -42,7 +42,7 @@
4242
},
4343
"generated_by": "Josh Berkus",
4444
"meta-spec": {
45-
"version": "1.0.0",
45+
"version": "1.0.1",
4646
"url": "http://pgxn.org/meta/spec.txt"
4747
},
4848
"tags": [

Makefile

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,37 @@
22

33
MODULE_big = jsquery
44
OBJS = jsonb_gin_ops.o jsquery_constr.o jsquery_extract.o \
5-
jsquery_gram.o jsquery_io.o jsquery_op.o jsquery_support.o
5+
jsquery_gram.o jsquery_io.o jsquery_op.o jsquery_support.o \
6+
monq_gram.o monq_scan.o monq_get_jsquery.o monq_create_query.o monq_delete_query.o
67

78
EXTENSION = jsquery
8-
DATA = jsquery--1.0.sql
9-
INCLUDES = jsquery.h
9+
DATA = jsquery--1.0.1.sql
10+
INCLUDES = jsquery.h monq.h
1011

1112
REGRESS = jsquery
1213
# We need a UTF8 database
1314
ENCODING = UTF8
1415

1516
EXTRA_CLEAN = y.tab.c y.tab.h \
16-
jsquery_gram.c jsquery_scan.c jsquery_gram.h
17+
jsquery_gram.c jsquery_scan.c jsquery_gram.h \
18+
monq_gram.c monq_scan.c monq_gram.h
1719

18-
ifdef USE_PGXS
1920
PG_CONFIG ?= pg_config
2021
PGXS := $(shell $(PG_CONFIG) --pgxs)
2122
include $(PGXS)
22-
else
23-
subdir = contrib/jsquery
24-
top_builddir = ../..
25-
include $(top_builddir)/src/Makefile.global
26-
include $(top_srcdir)/contrib/contrib-global.mk
27-
endif
2823

2924
jsquery_gram.o: jsquery_scan.c
3025

3126
jsquery_gram.c: BISONFLAGS += -d
3227

33-
distprep: jsquery_gram.c jsquery_scan.c
28+
monq_gram.o: monq_scan.c
29+
30+
monq_gram.c: BISONFLAGS += -d
31+
32+
distprep: jsquery_gram.c jsquery_scan.c monq_gram.c monq_scan.c
3433

3534
maintainer-clean:
36-
rm -f jsquery_gram.c jsquery_scan.c jsquery_gram.h
35+
rm -f jsquery_gram.c jsquery_scan.c jsquery_gram.h monq_gram.c monq_scan.c monq_gram.h
3736

3837
install: installincludes
3938

expected/jsquery.out

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,4 +2913,90 @@ select v from test_jsquery where v @@ 'array = [2,3]' order by v;
29132913
{"array": [2, 3]}
29142914
(1 row)
29152915

2916+
---MongoDB query translator tests
2917+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : 1 }');
2918+
?column?
2919+
----------
2920+
t
2921+
(1 row)
2922+
2923+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $eq : 1 } }');
2924+
?column?
2925+
----------
2926+
t
2927+
(1 row)
2928+
2929+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $ne : 1 } }');
2930+
?column?
2931+
----------
2932+
f
2933+
(1 row)
2934+
2935+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $lt : 1 } }');
2936+
?column?
2937+
----------
2938+
f
2939+
(1 row)
2940+
2941+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $lte : 1 } }');
2942+
?column?
2943+
----------
2944+
t
2945+
(1 row)
2946+
2947+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $gt : 1 } }');
2948+
?column?
2949+
----------
2950+
f
2951+
(1 row)
2952+
2953+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $gte : 1 } }');
2954+
?column?
2955+
----------
2956+
t
2957+
(1 row)
2958+
2959+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $in : [2,3] } }');
2960+
?column?
2961+
----------
2962+
f
2963+
(1 row)
2964+
2965+
select '{"a": {"b": 1 } }'::jsonb @@ parse_mquery('{ "a.b" : { $nin : [2,3] } }');
2966+
?column?
2967+
----------
2968+
t
2969+
(1 row)
2970+
2971+
select '{ "a" : 2 }'::jsonb @@ parse_mquery('{ a : { $exists : false } }');
2972+
?column?
2973+
----------
2974+
f
2975+
(1 row)
2976+
2977+
select '{ "a" : 2 }'::jsonb @@ parse_mquery('{ a : { $exists : true } }');
2978+
?column?
2979+
----------
2980+
t
2981+
(1 row)
2982+
2983+
select parse_mquery('{ is : { $lt: 1 } }')::jsquery;
2984+
parse_mquery
2985+
--------------
2986+
"is" < 1
2987+
(1 row)
2988+
2989+
select v from test_jsquery where v @@ parse_mquery('{ array : { $all: [2,3] } }') order by v;
2990+
v
2991+
----------------------
2992+
{"array": [2, 3]}
2993+
{"array": [1, 2, 3]}
2994+
{"array": [2, 3, 4]}
2995+
(3 rows)
2996+
2997+
select v from test_jsquery where v @@ parse_mquery('{ { $text: { $search: "Flew" } } }');
2998+
v
2999+
---
3000+
(0 rows)
3001+
29163002
RESET enable_seqscan;

0 commit comments

Comments
 (0)