array_to_json re-encodes ARRAY of json type

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: array_to_json re-encodes ARRAY of json type
Date: 2012-02-20 12:30:13
Message-ID: CAJW2+qcd3+aOqHhRN9nJdFAqKQi5CJBSoDbX4z=hJ9_mFJU7Cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-02-20 13:35:14 Re: Potential reference miscounts and segfaults in plpython.c
Previous Message Jan Urbański 2012-02-20 10:05:43 Re: Potential reference miscounts and segfaults in plpython.c