Re: JSON for PG 9.2 - Mailing list pgsql-hackers

From Abhijit Menon-Sen
Subject Re: JSON for PG 9.2
Date
Msg-id 20120202145126.GA5221@toroid.org
Whole thread Raw
In response to Re: JSON for PG 9.2  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
At 2012-02-02 08:54:32 -0500, robertmhaas@gmail.com wrote:
>
> Someone is eventually going to propose a function with a  name like
> json_to_string() which, when given this JSON object, returns a
> three-character string with the PostgreSQL text type.

Ah, that's the bit I was missing. I thought you were talking about an
immediate error condition.

> That's useful and I support it.

Agreed. Also, now I understand that you are saying that json_to_string()
(json_string_to_text?) would fail if the result couldn't be represented
as a text in the current encoding, and that's sensible as well. I had
misunderstood "is going to admit of a number of error…" in your mail.

As for surrogate pairs, just to be clear, what I was proposing earlier
in the thread was to change json.c:json_lex_string() to detect errors
(e.g. only one half of a surrogate pair, which is the commonest error
I've encountered in the wild) and reject such strings.

Thanks for the explanation.

-- ams


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: patch for implementing SPI_gettypemod()
Next
From: Alvaro Herrera
Date:
Subject: Re: keywords in initdb are case-sensitive?