Search code examples
postgresqlpsqljsonb

Use jsonb_pretty for all printed JSONB in Postgres


Can .psqlrc be configured so that jsonb_pretty is applied to every JSONB column printed to console?

Expanded display automatic mode is very useful: https://stackoverflow.com/a/16108898/1007926

I want to use both jsonb_pretty and expanded display. Does jsonb_pretty work by inserting newlines into the string? I suppose this would this cause problems if applied to every JSONB select.

jsonb_pretty: https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE


Solution

  • No, it is not possible. psql has not any support for pretty print of JSON types.