Add option force_array for COPY JSON FORMAT This adds the force_array option, which is available exclusively when using COPY TO with the JSON format.
When enabled, this option wraps the output in a top-level JSON array (enclosed in square brackets with comma-separated elements), making the entire result a valid single JSON value. Without this option, the default behavior is to output a stream of independent JSON objects. Attempting to use this option with COPY FROM or with formats other than JSON will raise an error. Author: Joe Conway <[email protected]> Author: jian he <[email protected]> Reviewed-by: Junwang Zhao <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Florents Tselai <[email protected]> Reviewed-by: Andrew Dunstan <[email protected]> Discussion: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4c0390ac53b745c2800f6aa3d9ee2515d6ab499b Modified Files -------------- doc/src/sgml/ref/copy.sgml | 30 ++++++++++++++++++++++++++++++ src/backend/commands/copy.c | 13 +++++++++++++ src/backend/commands/copyto.c | 38 ++++++++++++++++++++++++++++++++++++-- src/bin/psql/tab-complete.in.c | 2 +- src/include/commands/copy.h | 1 + src/test/regress/expected/copy.out | 37 +++++++++++++++++++++++++++++++++++++ src/test/regress/sql/copy.sql | 13 +++++++++++++ 7 files changed, 131 insertions(+), 3 deletions(-)
