Do you know when you'll have an updated patch that addresses the minor issues brought up in review and the concern above?
Here's an update addressing the issues discussed:
- fieldsep and recordsep are used, no more fieldsep_csv - the command line option is --csv without short option and is equivalent to -P format=csv -P fieldsep=',' - pset output formats are reordered alphabetically on display - a couple more cases in the regression tests
Patch applies cleanly, compiles, doc gen ok, "make check" ok.
The patch adds a simple way to generate csv output from "psql" queries, much simpler than playing around with COPY or \copy. It allows to generate a clean CSV dump from something as short as:
sh> psql --csv -c 'TABLE foo' > foo.csv
Documentation is clear.
Test cover a significant number of cases (fieldsep, expanded, tuples-only). Although recordsep changes are not actually tested, it worked interactively and I think that tests are sufficient as is.
There are somehow remaining point about which a committer/other people input would be nice:
(1) There are some mild disagreement whether the fieldsep should be format specific shared with other format. I do not think that a specific fieldsep is worth it, but this is a marginal preference, and other people opinion differ. What is best is not obvious.
Pavel also suggested to have a special handling based on whether the fieldsep is explicitely set or not. I'm not too keen on that because it departs significantly from the way psql formatting is currently handled, and what is happening becomes unclear to the user.
(2) For interactive use, two commands are required: \pset format csv + \pset fieldsep ',' (or ';' or '\t' or whatever...). Maybe some \csv command similar to \H would be appropriate, or not, to set both values more efficiently. Could be something for another patch.
Not sure what is the status of the patch if we do not have a clear consensus.
I am sorry, but I don't think so this interface is good enough. Using | as default CSV separator is just wrong. It and only it is a problem. Any other is perfect.