]> git.8kb.co.uk Git - postgresql/pg_jsonb_opx/blob - README.md
Raise an error if un implemented append function called.
[postgresql/pg_jsonb_opx] / README.md
1 jsonb_opx
2 =========
3
4 Missing operators for jsonb in PostgreSQL 9.4, this may contain some errors and bad form as it's primarily just experimentation (i'm not a frequent C programmer; but everyone has to start somewhere right?).  Please test that it suits your requirements before using in any production scenario.
5
6 Provides
7 --------
8
9 The following behave like **hstore 1.x operators**; i.e. without nested jsonb traversal
10
11 * deletion using **-** operator
12   * jsonb_delete(jsonb, text)
13   * jsonb_delete(jsonb, numeric)
14   * jsonb_delete(jsonb, boolean)
15   * jsonb_delete(jsonb, text[])
16   * jsonb_delete(jsonb, numeric[])
17   * jsonb_delete(jsonb, boolean[])
18   * jsonb_delete(jsonb, jsonb)
19 * concatenation using **||** operator
20   * jsonb_concat(jsonb, jsonb)
21 * replacement using **#=** operator
22   * jsonb_replace(jsonb, jsonb)
23
24 All of the above are provided with the standard extension and can be installed via CREATE EXTENSION E.g:
25
26 ```sql
27 CREATE EXTENSION jsonb_opx;
28 ``` 
29
30 The following are intended to behave like **hstore 2.0 operators**;  i.e. recurse into nested jsonb path.
31
32 > As of 26/02/2015 there appears to be an effort discussed on pgsql-hackers for this type of path manipulation named <a href="http://github.com/erthalion/jsonbx" target="_blank">jsonbx</a> that appears to be much further ahead than my effort below.
33
34 * deletion at chained path using **#-** operator
35   * jsonb_delete_path(jsonb, text[])
36 * replacement at chained path using function (no operator)
37   * jsonb_replace_path(jsonb, text[], jsonb)
38
39 To install this extra functionality specify version 1.1 when using CREATE EXTENSION E.g:
40
41 ```sql
42 CREATE EXTENSION jsonb_opx VERSION '1.1';
43 ```
44
45 Or if you have version 1.0 already installed, use ALTER EXTENSION E.g:
46
47 ```sql
48 ALTER EXTENSION jsonb_opx UPDATE TO '1.1';
49 ```