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

From Davin Shearer
Subject Re: Emitting JSON to file using COPY TO
Date
Msg-id CALvfUkCNS80P2EH8rOJ3uoTZDJX3MEhk8aOD2iVJqLvveG8zNw@mail.gmail.com
Whole thread Raw
In response to Re: Emitting JSON to file using COPY TO  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Am I understanding something incorrectly?

No, you've got it.  You already covered the concerns there.

> That seems quite absurd, TBH. I know we've catered for some absurdity in
> the CSV code (much of it down to me), so maybe we need to be liberal in
> what we accept here too. IMNSHO, we should produce either a single JSON
> document (the ARRAY case) or a series of JSON documents, one per row
> (the LINES case).

For what it's worth, I agree with Andrew on this.  I also agree with COPY FROM allowing for potentially bogus commas at the end of non-arrays for interop with other products, but to not do that in COPY TO (unless there is some real compelling case to do so).  Emitting bogus JSON (non-array with commas) feels wrong and would be nice to not perpetuate that, if possible.

Thanks again for doing this.  If I can be of any help, let me know.  If\When this makes it into the production product, I'll be using this feature for sure.

-Davin


pgsql-hackers by date:

Previous
From: Tommy Pavlicek
Date:
Subject: Re: [PATCH] ltree hash functions
Next
From: Jeff Davis
Date:
Subject: Built-in CTYPE provider