Re: proposal - support tsv output format for psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - support tsv output format for psql
Date: 2020-12-23 16:08:06
Message-ID: CAFj8pRBf3PfgtDP_P_iF8_bHW8abJmGo894gbsGV0bY=2uDX0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

st 23. 12. 2020 v 16:54 odesílatel Bruce Momjian <bruce(at)momjian(dot)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(at)sss(dot)pgh(dot)pa(dot)us> napsal:
> >
> > Bruce Momjian <bruce(at)momjian(dot)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(at)momjian(dot)us> https://momjian.us
> EnterpriseDB https://enterprisedb.com
>
> The usefulness of a cup is in its emptiness, Bruce Lee
>
>

In response to

Browse pgsql-hackers by date

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