pgsql: Add json_array_elements_text function.

Started by Andrew Dunstanover 12 years ago3 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

Add json_array_elements_text function.

This was a notable omission from the json functions added in 9.3 and
there have been numerous complaints about its absence.

Laurence Rowe.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5264d9154178d3aeaa0359b43a450298a7ce7281

Modified Files
--------------
doc/src/sgml/func.sgml | 21 +++++++++++
src/backend/utils/adt/jsonfuncs.c | 67 ++++++++++++++++++++++++++++------
src/include/catalog/pg_proc.h | 2 +
src/include/utils/json.h | 1 +
src/test/regress/expected/json.out | 34 +++++++++++++++--
src/test/regress/expected/json_1.out | 34 +++++++++++++++--
src/test/regress/sql/json.sql | 6 ++-
7 files changed, 143 insertions(+), 22 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: pgsql: Add json_array_elements_text function.

Andrew Dunstan <andrew@dunslane.net> writes:

Add json_array_elements_text function.

Not 100% sure if this is from this commit or some earlier one, but in any
case please fix it:

jsonfuncs.c: In function 'populate_record_worker':
jsonfuncs.c:1286: warning: 'tupType' may be used uninitialized in this function
jsonfuncs.c:1287: warning: 'tupTypmod' may be used uninitialized in this function

Seeing this with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4), the current
standard compiler on RHEL6.

regards, tom lane

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

In reply to: Andrew Dunstan (#1)
Re: pgsql: Add json_array_elements_text function.

On Wed, Jan 29, 2014 at 08:51:26PM +0000, Andrew Dunstan wrote:

Add json_array_elements_text function.

This was a notable omission from the json functions added in 9.3 and
there have been numerous complaints about its absence.

Laurence Rowe.

The docs seem to have bug:

it says that the return value is SETOF json
(http://www.postgresql.org/docs/devel/static/functions-json.html)

While in reality (and based on name) it's setof text:

(depesz@[local]:5930) 14:45:43 [depesz]
$ \df json_array_elements_text
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+--------------------------+------------------+--------------------------------+--------
pg_catalog | json_array_elements_text | SETOF text | from_json json, OUT value text | normal
(1 row)

Best regards,

depesz