With the latest set of patches we encountered failure with the following query:
postgres@postgres=# SELECT JSON_QUERY(jsonpath '"aaa"', '$' RETURNING text); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. The connection to the server was lost. Attempting reset: Failed. Time: 11.165 ms
A colleague of mine, Anton Melnikov, proposed the following changes which slightly
alter coercion functions to process this kind of error correctly.