Re: proposal - support tsv output format for psql - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal - support tsv output format for psql
Date
Msg-id CAFj8pRBf3PfgtDP_P_iF8_bHW8abJmGo894gbsGV0bY=2uDX0g@mail.gmail.com
Whole thread Raw
In response to Re: proposal - support tsv output format for psql  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers


st 23. 12. 2020 v 16:54 odesílatel Bruce Momjian <bruce@momjian.us> napsal:
On Wed, Dec 23, 2020 at 04:39:48PM +0100, Pavel Stehule wrote:
>
>
> st 23. 12. 2020 v 16:24 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
>
>     Bruce Momjian <bruce@momjian.us> writes:
>     > On Wed, Dec 23, 2020 at 07:18:24AM +0100, Pavel Stehule wrote:
>     >> Implementation of tsv format should not be hard.
>     >> What do you think about this?
>
>     > How would you handle tabs in the data?
>
>     The main problem with csv is the severe lack of standardization
>     around what to do with corner cases (delimiters in data, empty
>     fields, etc).  Seems like "tsv" would be even worse.  Is there
>     an actual standard anywhere?
>
>
> Probably not - there are just common conventions.
>
> standard disallows tab chars inside
>
> https://www.iana.org/assignments/media-types/text/tab-separated-values

Is it too awkward to throw an error if there is a tab?

This is a question. Maybe more practical can be some form of escaping (in conformance with COPY tsv format) or using CSV rules for special chars (it does LO). But raising an error can be correct too. It is true, so typical data should not contain tabs. For example LO Calc can hold tabs in cell, can export data in cell, but the tabs in cells are not visible, and import data with tabs are broken (and then probably, the data with tabs are not common).


--
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: proposal - support tsv output format for psql
Next
From: Alexey Kondratov
Date:
Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly