But I found that the server crashes on certain forms of SQL when postgresql.conf has a 'shared_preload_libraries' that contains module 'pg_stat_statements' (my value was: 'pg_stat_statements,auth_delay,auto_explain,passwordcheck'). Only pg_stat_statements seems to cause the problem.
The offending SQL (I took it from the jsonb_sqljson.sql test file):
testdb=# SELECT JSON_EXISTS(jsonb '{"a": 1, "b": 2}', '$.* ? (@ > $x && @ < $y)' PASSING 0 AS x, 2 AS y); 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. Time: 2.551 ms !?>
(Of course, that SQL running during regression testing has no problems as there is then no pg_stat_statements.)
The statement sometimes succeeds but never very often.
The same crash was there before but I only now saw the connection with the 'shared_preload_libraries/pg_stat_statements'.
I seem to remember some things changed in pg_stat_statements but I didn't follow and don't know who to CC for it.
These issues are easily debugged - you can run gdb in the outer terminal, and attach it to the psql session. Then you can run the query.
Probably it will be a problem in pg_stat_statements callbacks - maybe query processing there doesn't know some new nodes that this patch introduces.