Re: JSON validation behavior

2018-10-24 Thread Andrew Dunstan
On 10/24/2018 11:54 AM, Tom Lane wrote: "David G. Johnston" writes: The following does seem buggy though: select json '{ "a": "null \u escape"}' -> 'a' as fails; Perhaps, but AFAICS it's entirely accidental that any variant of this doesn't fail. Although this manages not to fail: regr

Re: JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi > I could get behind fixing > it to always throw the error, but that's not what Sergei was hoping for. On the contrary i think it is reasonable way. It is much better to have error on input value instead of finding wrong value during table processing. We always reject this value for jsonb and

Re: JSON validation behavior

2018-10-24 Thread Tom Lane
"David G. Johnston" writes: > The following does seem buggy though: > select json '{ "a": "null \u escape"}' -> 'a' as fails; Perhaps, but AFAICS it's entirely accidental that any variant of this doesn't fail. Although this manages not to fail: regression=# select json '{ "a": "null \u

Re: JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi 24.10.2018, 17:40, "David G. Johnston" : > On Wed, Oct 24, 2018 at 7:25 AM Sergei Kornilov wrote: > >> DETAIL:  \u cannot be converted to text. >> >> Well, requested text type can not have \u byte. But seems strange: we >> test json type with this value but raise same error for -> ope

Re: JSON validation behavior

2018-10-24 Thread David G. Johnston
On Wed, Oct 24, 2018 at 7:25 AM Sergei Kornilov wrote: > > DETAIL: \u cannot be converted to text. > > Well, requested text type can not have \u byte. But seems strange: we > test json type with this value but raise same error for -> operator: > > We allow write such json to table, we al

JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi We have some json regression tests in src/test/regress/expected/json_encoding_1.out with \u symbol select json '{ "a": "null \u escape" }' as not_unescaped; not_unescaped { "a": "null \u escape" } (1 row) select json '{ "a":