summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorStephen Frost2014-09-12 01:23:51 +0000
committerStephen Frost2014-09-12 01:23:51 +0000
commit95d737ff45a38809130a2c633d9e6bc26c825036 (patch)
treed3d2c052b1def80edd36fa9751a793eca4a3e0e0 /doc/src
parentc3c75fcd7a03067d87b830e98e3698b683446762 (diff)
Add 'ignore_nulls' option to row_to_json
Provide an option to skip NULL values in a row when generating a JSON object from that row with row_to_json. This can reduce the size of the JSON object in cases where columns are NULL without really reducing the information in the JSON object. This also makes row_to_json into a single function with default values, rather than having multiple functions. In passing, change array_to_json to also be a single function with default values (we don't add an 'ignore_nulls' option yet- it's not clear that there is a sensible use-case there, and it hasn't been asked for in any case). Pavel Stehule
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 3a7cfa93c27..7195df85ff5 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10309,11 +10309,13 @@ table2-mapping
</row>
<row>
<entry>
- <literal>row_to_json(record [, pretty_bool])</literal>
+ <literal>row_to_json(rowval record [, pretty bool [, ignore_nulls bool] ])</literal>
</entry>
<entry>
Returns the row as a JSON object. Line feeds will be added between
- level-1 elements if <parameter>pretty_bool</parameter> is true.
+ level-1 elements if <parameter>pretty_bool</parameter> is true. Elements
+ with NULL values will be skipped when <parameter>ignore_nulls</parameter>
+ is true.
</entry>
<entry><literal>row_to_json(row(1,'foo'))</literal></entry>
<entry><literal>{"f1":1,"f2":"foo"}</literal></entry>