Re: csv format for psql

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: csv format for psql
Date: 2018-11-09 05:56:34
Message-ID: 20181109055634.GA22720@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 08, 2018 at 01:58:34PM +0900, Michael Paquier wrote:
> Anyway, I am still going through the patch, so no need to send a new
> version for now.

Okay, I have done a round of more in-depth review, and the patch looks
to be in pretty good shape.

Relying on tuples_only to decide if the header should be printed or not
looks good to me.

+ /* check for value being non-empty and with an MB length of 1 */
+ if (*value == '\0' || value[PQmblen(value, pset.encoding)] != '\0')

It seems to me that this can just be replaced with that:
if (strlen(value) != 1)

Attached is what I am finishing up with for the moment. Comments are
welcome. I am still planning look at that stuff a bit more once again,
particularly the printing part, but I am lacking of time now..
--
Michael

Attachment Content-Type Size
psql-csv-michael.patch text/x-diff 19.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-11-09 06:18:26 Re: Speeding up INSERTs and UPDATEs to partitioned tables
Previous Message Amit Langote 2018-11-09 05:45:18 Re: Performance improvements of INSERTs to a partitioned table