Re: csv format for psql

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: csv format for psql
Date: 2018-03-29 15:08:49
Message-ID: CAKFQuwYE0prgsFxUDByG3xPKK3hA4BQuFqFr71ai2yif-kQYmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 29, 2018 at 7:30 AM, Daniel Verite <daniel(at)manitou-mail(dot)org>
wrote:

> David G. Johnston wrote:
>
> > Unaligned format could grow its own fieldsep if it wanted to but it can
> > also just use the default provided fieldsep var whose default value is
> > pipe. If it did grow one it would need to understand "not set" in order
> to
> > preserve existing behavior. We don't have that problem with csv.
>
> fielsep is already owned by the unaligned format. No other format
> uses fieldsep currently. Why would it needs to grow its own?
> I don't quite see what you mean here.
>

​ ​Its mostly a terminology concern...

>
> For csv, Fabien and Peter expressed the opinion that we shouldn't
> create another fieldsep-like variable specifically for it, but instead
> reuse fieldsep. That's what my latest patch does.
>
> Now it turns out that sharing fieldsep comes with some problems.
> ​[...]​
>
>
> Personally I think the benefit of sharing fieldsep is not worth these
> problems, but I'm waiting for the discussion to continue with
> more opinions.

Basically that because "fieldsep" lacks any kind of suffix it can be
considered "unowned" versus "fieldsep_csv" which would be "owned" by the
"csv" format.​ Given the problems I do want an "owned by csv" variable.
An owned version for unaligned would then be named "fieldsep_unaligned".
But we wouldn't want to rename fieldsep, we'd simply leave it in place as a
generic fieldsep variable that formats can choose to use if they wish -
with the limitations that come with sharing it with unaligned. Decent odds
that no other format would want to but we cannot remove it so we might as
well better describe its place now that two formats care about field
separation.

fieldsep is "shared" even though at present no one else is sharing it.
fieldsep_csv is not shared. fieldsep_unaligned doesn't exist because
unaligned uses the shared variable. No one else uses fieldsep, shared or
owned.

Saying the "fieldsep" is owned by unaligned mode would be technically
correct, though there is no "mark" that makes is readily obvious.

Implementation wise "ownership" could mean that changing the delimiter can
only occur while the format type matches. But we could not do that for
fieldsep since no such ordering currently is enforced.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2018-03-29 15:43:30 Re: Commit 4dba331cb3 broke ATTACH PARTITION behaviour.
Previous Message Pierre Ducroquet 2018-03-29 15:03:08 Re: JIT compiling with LLVM v12