array_to_json re-encodes ARRAY of json type - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject array_to_json re-encodes ARRAY of json type
Date
Msg-id CAJW2+qcd3+aOqHhRN9nJdFAqKQi5CJBSoDbX4z=hJ9_mFJU7Cg@mail.gmail.com
Whole thread Raw
Responses Re: array_to_json re-encodes ARRAY of json type
List pgsql-hackers
If we pass an ARRAY of json type to array_to_json() function, the
function seems to
re-encode the JSON text. But should the following examples be the same result?
I'm not sure why we don't have a special case for json type in datum_to_json()
-- do we need to pass-through json types in it?

=# \x
=# SELECT '["A"]'::json,         array_to_json(ARRAY['A']),         array_to_json(ARRAY['"A"'::json]);
-[ RECORD 1 ]-+----------
json          | ["A"]
array_to_json | ["A"]
array_to_json | ["\"A\""]

-- 
Itagaki Takahiro


pgsql-hackers by date:

Previous
From: Jan Urbański
Date:
Subject: Re: Potential reference miscounts and segfaults in plpython.c
Next
From: Robert Haas
Date:
Subject: Re: Potential reference miscounts and segfaults in plpython.c