Select the fields in a JSONB field in postgres with ->>. Use -> for selecting in the form
->>
->
SELECT id, serialized_params FROM good_jobs WHERE serialized_params->>arguments = '[111777111]' LIMIT 1;
Easy export to a CSV file, with headers.
# sql \COPY (SELECT * FROM report_view_table) TO 'export.csv' DELIMITER ',' CSV HEADER; # bash psql $DATABASE -c "\COPY (SELECT * FROM report_table) TO 'export.csv' DELIMITER ',' CSV HEADER;"
$ createdb -E UTF8 -T template0 --locale=en_US.UTF-8 <name> # to figure out actual locale value (sometimes listed as utf8), or UTF8, use locale $ locale -a | grep en