Add support for Postgresql JSONB

This is the updated version of #15195 and #15950 by @pcreux and @chris-teague.

It is tested against postgresql-9.4beta.

Test cases shared between json and jsonb are extracted to a module called `PostgresqlJSONSharedTestCases`. I made my best to minimise the amount of lines impacted by this extraction.