You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Fix conversion of JSON strings to JSON output columns in json_to_record().
json_to_record(), when an output column is declared as type json or jsonb,should emit the corresponding field of the input JSON object. But it gotthis slightly wrong when the field is just a string literal: it failed toescape the contents of the string. That typically resulted in syntaxerrors if the string contained any double quotes or backslashes.jsonb_to_record() handles such cases correctly, but I added correspondingtest cases for it too, to prevent future backsliding.Improve the documentation, as it provided only a very hand-wavydescription of the conversion rules used by these functions.Per bug report from Robert Vollmert. Back-patch to v10 where theerror was introduced (by commitcf35346).Note that PG 9.4 - 9.6 also get this case wrong, but differently so:they feed the de-escaped contents of the string literal to json[b]_in.That behavior is less obviously wrong, so possibly it's being depended onin the field, so I won't risk trying to make the older branches behavelike the newer ones.Discussion:https://postgr.es/m/D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net