Re: csv format for psql - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: csv format for psql
Date
Msg-id alpine.DEB.2.21.1808281954040.21980@lancre
Whole thread Raw
In response to Re: csv format for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: csv format for psql
List 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).

Ok.

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

Indeed.

> 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.

-- 
Fabien.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump test instability
Next
From: Tom Lane
Date:
Subject: Re: More parallel pg_dump bogosities