We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent6f99151 commit9279d1aCopy full SHA for 9279d1a
README.md
@@ -187,6 +187,25 @@ examples.
187
188
Same rules apply when you search inside objects and branchy structures.
189
190
+Type checking operators and "every" placeholders are useful for document
191
+schema validation. JsQuery matchig operator`@@` is immutable and can be used
192
+in CHECK constraint. See following example.
193
+
194
+```sql
195
+CREATETABLEjs (
196
+ idserial,
197
+ data jsonb,
198
+CHECK (data @@'
199
+ name IS STRING AND
200
+ similar_ids.#: IS NUMERIC AND
201
+ points.#:(x IS NUMERIC AND y IS NUMERIC)'::jsquery));
202
+```
203
204
+In this example check constraint validates that in "data" jsonb column:
205
+value of "name" key is string, value of "similar_ids" key is array of numerics,
206
+value of "points" key is array of objects which contain numeric values in
207
+"x" and "y" keys.
208
209
See our
210
[pgconf.eu presentation](http://www.sai.msu.su/~megera/postgres/talks/pgconfeu-2014-jsquery.pdf)
211
for more examples.