Re: Add json_typeof() and json_is_*() functions. - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Add json_typeof() and json_is_*() functions.
Date
Msg-id 20130802145657.GJ5669@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Add json_typeof() and json_is_*() functions.  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure escribió:
> On Fri, Aug 2, 2013 at 7:22 AM, Andrew Tipton <andrew@kiwidrew.com> wrote:
> > On Fri, Aug 2, 2013 at 8:12 PM, Robert Haas <robertmhaas@gmail.com> 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 for json_is_array().
> > 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')
> >
> > And it protects the user against forgetting about, say, the 'null' typeof()
> > when constructing their check expression.
> 
> right: I was thinking also that if/when json were ever to get new
> types, you'd appreciate that function.

That was what I thought as well upon seen the code.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Next
From: Alvaro Herrera
Date:
Subject: Re: Immediate shutdown causes the assertion failure in 9.4dev