Re: csv format for psql

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: csv format for psql
Date: 2018-08-28 18:54:02
Message-ID: alpine.DEB.2.21.1808281954040.21980@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bonjour Daniel,

> Currently popt->topt.fieldSepCsv can't be NULL so I've simplified this
> to just return pset_quoted_string(popt->topt.fieldSepCsv).


>> While testing I found a small issue if "fieldsep_csv" is set to a strange
>> value:
>> \pset format_csv ',,'
> You meant \pset fieldsep_csv ',,'


> If you do that even SELECT 'foo', 'bar' comes out wrong because it looks
> like a 3-field row: foo,,bar

Yes and no. I asked for ",," as a separator, so probably I really want
that and I'd be okay with the result.

> If we want to prevent people to shoot themselves in the foot with that
> sort of thing, I've added a couple tests: No double quote, no LF or
> CR, single character (but multibyte allowed) for the separator.

Ok, why not.

Patch applies cleanly, compiles, "make check" ok.

I tried "\pset fieldsep_csv '\0'" which could be seen as one character,
but it does not want it. I'm okay with this behavior.

I'd suggest to add a test about rejected fieldsep_csv values, which raises
both errors.


In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2018-08-28 19:05:13 Re: BUG #15307: Low numerical precision of (Co-) Variance
Previous Message Tom Lane 2018-08-28 18:47:17 Re: pg_dump test instability