Re: Add json_typeof() and json_is_*() functions.

From: Andrew Tipton <andrew(at)kiwidrew(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add json_typeof() and json_is_*() functions.
Date: 2013-08-02 12:22:24
Message-ID: CA+M2pVWjFYAtCpGSae3yJE7T+N6v288bSd=LoWXkvTLbCiNMWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 2, 2013 at 8:12 PM, Robert Haas <robertmhaas(at)gmail(dot)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.

Regards,
Andrew Tipton

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-08-02 12:27:38 Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Previous Message Robert Haas 2013-08-02 12:21:37 Re: Immediate shutdown causes the assertion failure in 9.4dev