Re: Calling json_* functions with JSONB data - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Calling json_* functions with JSONB data
Date
Msg-id CAKFQuwZazz+8YLueMV1p4+RzkaAmGyXyfV2xDjbdC8+hU6eEOQ@mail.gmail.com
Whole thread Raw
In response to Re: Calling json_* functions with JSONB data  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: Calling json_* functions with JSONB data  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-hackers
On Mon, May 23, 2016 at 5:38 PM, Jim Nasby <Jim.Nasby@bluetreble.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.


​"""
​The name of the new function must not match any existing function with the same input argument types in the same schema. However, functions of different argument types can share a name (this is called overloading).
"""

Admittedly the absence of "output" is not emphasized but overloading in (most?) languages (small sample size for personal knowledge) is subject to the same restriction.

David J.
 

pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Calling json_* functions with JSONB data
Next
From: Tom Lane
Date:
Subject: Re: Re: [BUGS] BUG #14153: Unrecognized node type error when upsert is present in recursive CTE