Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-10-10 Thread Andrew Dunstan
On 08/06/2013 08:42 AM, Robert Haas wrote: On Fri, Aug 2, 2013 at 8:22 AM, Andrew Tipton wrote: But without json_is_scalar(), the choice is one of these two forms: json_typeof() NOT IN ('object', 'array') json_typeof() IN ('string', 'number', 'boolean', 'null') The first of those is wha

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-08-06 Thread Robert Haas
On Fri, Aug 2, 2013 at 8:22 AM, Andrew Tipton wrote: > But without json_is_scalar(), the choice is one of these two forms: > json_typeof() NOT IN ('object', 'array') > json_typeof() IN ('string', 'number', 'boolean', 'null') The first of those is what seemed to make sense to me. The user can

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-08-02 Thread Alvaro Herrera
Merlin Moncure escribió: > On Fri, Aug 2, 2013 at 7:22 AM, Andrew Tipton wrote: > > On Fri, Aug 2, 2013 at 8:12 PM, Robert Haas wrote: > >> > >> +1, but I'm wondering why we need anything more than just > >> json_typeof(). Doesn't that pretty much cover it? > > > > I agree with Merlin that json_

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-08-02 Thread Merlin Moncure
On Fri, Aug 2, 2013 at 7:22 AM, Andrew Tipton wrote: > On Fri, Aug 2, 2013 at 8:12 PM, Robert Haas wrote: >> >> +1, but I'm wondering why we need anything more than just >> json_typeof(). Doesn't that pretty much cover it? > > > I agree with Merlin that json_is_object() is superfluous, since it

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-08-02 Thread Andrew Tipton
On Fri, Aug 2, 2013 at 8:12 PM, Robert Haas wrote: > +1, but I'm wondering why we need anything more than just > json_typeof(). Doesn't that pretty much cover it? > I agree with Merlin that json_is_object() is superfluous, since it can just be replaced with json_typeof() = 'object'. Likewise f

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-08-02 Thread Robert Haas
On Mon, Jul 29, 2013 at 5:36 PM, Merlin Moncure wrote: > On Mon, Jul 29, 2013 at 2:16 AM, Andrew Tipton wrote: >> The attached patch adds four new SQL functions for the JSON type: >> json_typeof(json) RETURNS text >> json_is_object(json) RETURNS boolean >> json_is_array(json) RETURNS

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-07-29 Thread Merlin Moncure
On Mon, Jul 29, 2013 at 2:16 AM, Andrew Tipton wrote: > The attached patch adds four new SQL functions for the JSON type: > json_typeof(json) RETURNS text > json_is_object(json) RETURNS boolean > json_is_array(json) RETURNS boolean > json_is_scalar(json) RETURNS boolean > > The mot

Re: [HACKERS] Add json_typeof() and json_is_*() functions.

2013-07-29 Thread Andrew Dunstan
On 07/29/2013 03:16 AM, Andrew Tipton wrote: The attached patch adds four new SQL functions for the JSON type: json_typeof(json) RETURNS text json_is_object(json) RETURNS boolean json_is_array(json) RETURNS boolean json_is_scalar(json) RETURNS boolean Please add to the next

[HACKERS] Add json_typeof() and json_is_*() functions.

2013-07-29 Thread Andrew Tipton
The attached patch adds four new SQL functions for the JSON type: json_typeof(json) RETURNS text json_is_object(json) RETURNS boolean json_is_array(json) RETURNS boolean json_is_scalar(json) RETURNS boolean The motivating use-case for this patch is the ability to easily create a do