|From:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|To:||Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>|
|Cc:||PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: PATCH: Implement value_to_json for single-datum conversion|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> writes:
> Whenever I try to work with the new json types I trip over the lack of a
> function to escape text to json. The attached patch against master
> provides one by exposing the existing datum_to_json function to SQL.
> This feels basic enough that I'm wondering if there's a reason it wasn't
> included from the start,
There actually was a previous thread about this:
Note in particular Andrew's comment:
Second, RFC 4627 is absolutely clear: a valid JSON value can
only be an object or an array, so this thing about converting
arbitrary datum values to JSON is a fantasy. If anything, we
should adjust the JSON input routines to disallow anything else,
rather than start to output what is not valid JSON.
It's possible he's misread the spec, but I think we ought to tread very
carefully before adding "obvious" conversions we might regret later.
> Please consider this for the 9.2 branch as well as to HEAD, as IMO it's
> very important for basic usability of the json functionality. It applies
> to 9.2 fine and passes "make check". I know it's late in the game,
It's several months too late for feature additions to 9.2, especially
ones that would require an initdb to install. We can look at this for
9.3, but I'm still worried about the spec-compliance question.
regards, tom lane
|Next Message||Craig Ringer||2012-08-13 05:33:01||Re: PATCH: Implement value_to_json for single-datum conversion|
|Previous Message||Tom Lane||2012-08-13 04:33:00||Re: PATCH: Implement value_to_json for single-datum conversion|