Re: Emitting JSON to file using COPY TO - Mailing list pgsql-general

From Filip Sedlák
Subject Re: Emitting JSON to file using COPY TO
Date
Msg-id 3a98decf-3fe3-4b49-9b68-fda01338872c@sedlakovi.org
Whole thread Raw
In response to Re: Emitting JSON to file using COPY TO  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: Emitting JSON to file using COPY TO
List pgsql-general
This would be a very special case for COPY. It applies only to a single 
column of JSON values. The original problem can be solved with psql 
--tuples-only as David wrote earlier.


$ psql -tc 'select json_agg(row_to_json(t))
              from (select * from public.tbl_json_test) t;'

  [{"id":1,"t_test":"here's a \"string\""}]


Special-casing any encoding/escaping scheme leads to bugs and harder 
parsing.

Just my 2c.

--
Filip Sedlák



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Installing extension temporal_tables for PG13
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Could not read from file "pg_subtrans/00F5" at offset 122880: Success.