Re: Calling json_* functions with JSONB data

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Peter van Hardenberg <pvh(at)pvh(dot)ca>, "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Calling json_* functions with JSONB data
Date: 2016-05-24 14:09:41
Message-ID: 1f8a6917-2421-34df-402c-ee6ad4a6ed63@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/23/16 4:45 PM, David G. Johnston wrote:
> On Mon, May 23, 2016 at 5:38 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com
> <mailto:Jim(dot)Nasby(at)bluetreble(dot)com>>wrote:
>
> On 5/23/16 11:55 AM, Peter van Hardenberg wrote:
>
> Fortunately, this seems quite easy to resolve by taking
> advantage of our
> ability to add json_*(jsonb) form of the functions.
>
>
> Another issue no one has mentioned is functions that return
> JSON/JSONB. IMO those should NOT be overloaded, because that will
> make it very easy to accidentally change from one type to the other
> without meaning to.
>
>
> ​Actually, by definition they cannot be overloaded. A function's
> signature is derived from its input types only.

My point is that while it would be possible to create something like
json_strip_nulls(jsonb) to go with json_strip_nulls(json), that would be
a bad idea, because it makes it easily to accidentally turn your jsonb
into plain json.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Shaplov 2016-05-24 14:12:16 [PROPOSAL] Move all am-related reloption code into src/backend/access/[am-name] and get rid of relopt_kind
Previous Message Nikolay Shaplov 2016-05-24 14:06:54 [PROPOSAL][PROTOTYPE] Individual options for each index column: Opclass options