On Mon, 18 Dec 2023 at 16:38, Christoph Berg <m...@debian.org> wrote: > We'd want both patches even if they do the same thing on two different > levels, I'd say.
Makes sense. One thing I was still wondering is if it wouldn't be easier to wrap all queries in "copy (select whatever) to stdout (format json)" automatically when the -J flag is passed psql. Because it would be nice not to have to implement this very similar logic in two places. But I guess that approach does not work for commands that don't work inside COPY, i.e. DML and DDL. I'm assuming your current patch works fine with DML/DDL. If that's indeed the case then I agree it makes sense to have this patch. And another big benefit is that it wouldn't require a new Postgres server function for the json functionality of psql.