Re: COPY WITH CSV FORCE QUOTE * -- REVIEW

Lists: pgsql-hackers
From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: COPY WITH CSV FORCE QUOTE *
Date: 2009-05-12 04:49:14
Message-ID: 20090512131316.9514.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

FORCE QUOTE option of COPY WITH CSV requires an explicit column list,
but '*' (all columns) would be also useful for typical usages.

I searched the ML archive and found one request before:
| COPY TO with FORCE QUOTE *
| http://archives.postgresql.org/pgsql-sql/2008-08/msg00084.php

The attached is a WIP patch add a support of '*' for FORCE QUOTE
and FORCE NOT NULL options. I'd like to submit it for the next
commit fest (8.5). Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
force_quote_all-20090512.patch application/octet-stream 4.5 KB

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-14 05:39:10
Message-ID: 3073cc9b0907132239j420dfdc7na4b362458a2495e4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, May 11, 2009 at 11:49 PM, Itagaki
Takahiro<itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
> Hi,
>
> The attached is a WIP patch add a support of '*' for FORCE QUOTE
> and FORCE NOT NULL options. I'd like to submit it for the next
> commit fest (8.5). Comments welcome.
>

this patch applies almost cleanly except for a hunk in gram.y
about the patch itself, i can find value for FORCE QUOTE * but what's
the use case for FORCE NOT NULL?

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157


From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-14 06:26:15
Message-ID: 20090714152309.944E.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> wrote:

> i can find value for FORCE QUOTE * but what's
> the use case for FORCE NOT NULL?

NULLs are not quoted (to be ,, ) because empty strings are written as "".
It comes from original implementation and not from my patch.
I think we don't need to change the behavior.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-14 07:26:06
Message-ID: 20090714162110.9457.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> wrote:
>
> > i can find value for FORCE QUOTE * but what's
> > the use case for FORCE NOT NULL?

Oh, sorry. I misread your mail.
The patch adds * options "FORCE QUOTE" and "FORCE NOT NULL", too.
Both of * mean all-columns for each options.

The attached is an updated version of patch; just add documenation
to copy.sgml.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
force_quote_all-20090714.patch application/octet-stream 8.1 KB

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-14 07:58:48
Message-ID: 3073cc9b0907140058p18e1f600lbac58f363ba57118@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 14, 2009 at 2:26 AM, Itagaki
Takahiro<itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>
>> Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> wrote:
>>
>> > i can find value for FORCE QUOTE * but what's
>> > the use case for FORCE NOT NULL?
>
> Oh, sorry. I misread your mail.
> The patch adds * options "FORCE QUOTE" and "FORCE NOT NULL", too.
> Both of * mean all-columns for each options.
>

and i misunderstood your patch... is actually an extend of an existing
functionality, and both options are necesary for consistency...
do you hear an echo here? ;)

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-14 16:31:34
Message-ID: 4A5CB2E6.8040502@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Itagaki Takahiro wrote:
>> Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> wrote:
>>
>>
>>> i can find value for FORCE QUOTE * but what's
>>> the use case for FORCE NOT NULL?
>>>
>
> Oh, sorry. I misread your mail.
> The patch adds * options "FORCE QUOTE" and "FORCE NOT NULL", too.
> Both of * mean all-columns for each options.
>
>

I still don't understand the use case for FORCE NOT NULL *.

FORCE QUOTE * is relatively benign. In particular, it doesn't affect the
null-preserving properties of our CSV implementation, since it still
won't (or shouldn't) quote null values.

FORCE NOT NULL is in any case a fairly blunt instrument - it doesn't
work for a column of any type that doesn't accept an empty string as
valid input, such as numeric types.

I note that this patch was (I think) originally submitted without prior
discussion. That's not following best practice.

cheers

andrew


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-16 18:47:15
Message-ID: 4A5F75B3.9020405@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

All,

1) Patch applies cleanly against CVS head.

2) Patch compiles and builds cleanly.

3) Unable to check docs because of general doc build problems.

4) Tested the following commands, using a 10MB table of PostgreSQL log data:

postgres=# COPY marchlog TO '/tmp/marchlog1.csv' with csv header;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog2.csv' with csv header force
quote *;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog3.csv' with csv header force
quote process_id;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog4.csv' with csv force quote *;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog5.csv' with force quote *;
ERROR: COPY force quote available only in CSV mode
STATEMENT: COPY marchlog TO '/tmp/marchlog5.csv' with force quote *;
ERROR: COPY force quote available only in CSV mode

postgres=# COPY reloadlog FROM '/tmp/marchlog2.csv' with csv header;
COPY 81097

postgres-# \copy marchlog TO '/tmp/marchlog5.csv' with csv force quote *;
postgres-#

Per discussion, I did not test FORCE QUOTE NOT NULL *.

All output looked as expected. This patch did not seem to change
eariler functionality, and seems to quote as specified.

Unless there are other things we want to test (CLOBs?) I think the patch
is probably ready for code review of the FORCE QUOTE * portion.

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-16 19:03:27
Message-ID: 4A5F797F.4040508@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew,

> FORCE NOT NULL is in any case a fairly blunt instrument - it doesn't
> work for a column of any type that doesn't accept an empty string as
> valid input, such as numeric types.

Con: this allows COPY to produce output which cannot be reloaded into
PostgreSQL.

Pro: there is a lot of extremely broken external software which expects
"nulls" to be expressed as "". This improves compatiblity with them.

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-16 19:26:26
Message-ID: 4A5F7EE2.5000704@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus wrote:
> Andrew,
>
>> FORCE NOT NULL is in any case a fairly blunt instrument - it doesn't
>> work for a column of any type that doesn't accept an empty string as
>> valid input, such as numeric types.
>
> Con: this allows COPY to produce output which cannot be reloaded into
> PostgreSQL.
>
> Pro: there is a lot of extremely broken external software which
> expects "nulls" to be expressed as "". This improves compatiblity
> with them.
>

FORCE NOT NULL is only valid when we import data, not when we export
data, so what other programs expect to receive is irrelevant to any
argument about FORCE NOT NULL.

AFAICT on a brief look at the patch, it doesn't affect the quoting of
nulls on export, it just allows * as an alias for all columns for FORCE
QUOTE (as well as FORCE NOT NULL). But FORCE QUOTE has never forced
quoting of null values, only non-null values. We have never quoted null
values, and I'm fairly resistant to any suggestion that we should.

As for importing data from programs that produce all values in quotes
including null/missing values (your pro case above), arguably what we
need is another flag that would turn an empty string into a null.

cheers

andrew


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-16 19:53:50
Message-ID: 603c8f070907161253reca92ees2310ab9d7e19d3d7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jul 16, 2009 at 2:47 PM, Josh Berkus<josh(at)agliodbs(dot)com> wrote:
> Unless there are other things we want to test (CLOBs?) I think the patch is
> probably ready for code review of the FORCE QUOTE * portion.

I think perhaps we should ask the patch author to remove the NOT NULL
stuff first?

...Robert


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-16 20:13:22
Message-ID: 4A5F89E2.50507@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew,

> AFAICT on a brief look at the patch, it doesn't affect the quoting of
> nulls on export, it just allows * as an alias for all columns for FORCE
> QUOTE (as well as FORCE NOT NULL). But FORCE QUOTE has never forced
> quoting of null values, only non-null values. We have never quoted null
> values, and I'm fairly resistant to any suggestion that we should.

See? That's what happens when I can't build the docs. ;-) (and
there's no previous discussion of the feature).

>
> As for importing data from programs that produce all values in quotes
> including null/missing values (your pro case above), arguably what we
> need is another flag that would turn an empty string into a null.

ooooh, TODO, please? There's a lot of this out there, and I've had to
build sed into a lot of import routines.

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-16 20:13:59
Message-ID: 4A5F8A07.3010307@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 7/16/09 12:53 PM, Robert Haas wrote:
> On Thu, Jul 16, 2009 at 2:47 PM, Josh Berkus<josh(at)agliodbs(dot)com> wrote:
>> Unless there are other things we want to test (CLOBs?) I think the patch is
>> probably ready for code review of the FORCE QUOTE * portion.
>
> I think perhaps we should ask the patch author to remove the NOT NULL
> stuff first?

Yes, current status is "Waiting on Author".

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Chris Spotts <rfusca(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-16 20:40:03
Message-ID: 4A5F9023.2030200@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus wrote:
> Andrew,
>
>> AFAICT on a brief look at the patch, it doesn't affect the quoting of
>> nulls on export, it just allows * as an alias for all columns for FORCE
>> QUOTE (as well as FORCE NOT NULL). But FORCE QUOTE has never forced
>> quoting of null values, only non-null values. We have never quoted null
>> values, and I'm fairly resistant to any suggestion that we should.
>
> See? That's what happens when I can't build the docs. ;-) (and
> there's no previous discussion of the feature).
>
>>
>> As for importing data from programs that produce all values in quotes
>> including null/missing values (your pro case above), arguably what we
>> need is another flag that would turn an empty string into a null.
>
> ooooh, TODO, please? There's a lot of this out there, and I've had to
> build sed into a lot of import routines.
>
+1 For that on the TODO, happens all the time...


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Chris Spotts <rfusca(at)gmail(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-16 20:55:31
Message-ID: 4A5F93C3.4090809@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Chris Spotts wrote:
>>>
>>> As for importing data from programs that produce all values in quotes
>>> including null/missing values (your pro case above), arguably what we
>>> need is another flag that would turn an empty string into a null.
>>
>> ooooh, TODO, please? There's a lot of this out there, and I've had
>> to build sed into a lot of import routines.
>>
> +1 For that on the TODO, happens all the time...
>

Well, somebody had better suggest a syntax for it, preferably without
adding yet another keyword.

cheers

andrew


From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-17 03:56:29
Message-ID: 20090717104555.895D.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> On 7/16/09 12:53 PM, Robert Haas wrote:
> > I think perhaps we should ask the patch author to remove the NOT NULL
> > stuff first?
>
> Yes, current status is "Waiting on Author".

OK, I removed "FORCE NOT NULL" stuff from the patch.
The attached patch only adds "FORCE QUOTE *" feature.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
force_quote_all-20090717.patch application/octet-stream 4.9 KB

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-20 22:57:52
Message-ID: 4A64F670.6060709@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Itagaki-san,

On Apple OS 10.5:

1. new patch applied cleanly
2. new patch built cleanly
3. regression tests pass
4. Tested following operations:

postgres=# COPY marchlog TO '/tmp/marchlog1.csv' with csv header;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog2.csv' with csv header force
quote *;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog3.csv' with csv header force
quote process_id;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog4.csv' with csv force quote *;
COPY 81097
postgres=# COPY marchlog TO '/tmp/marchlog5.csv' with force quote *;
ERROR: COPY force quote available only in CSV mode
STATEMENT: COPY marchlog TO '/tmp/marchlog5.csv' with force quote *;
ERROR: COPY force quote available only in CSV mode

postgres=# COPY reloadlog FROM '/tmp/marchlog2.csv' with csv header;
COPY 81097

postgres-# \copy marchlog TO '/tmp/marchlog5.csv' with csv force quote *;
postgres-#

5. Regression tests for FORCE QUOTE present.
6. Docs present; not sure how good they are, see prior discussion.

Stuff someone else should do:

a. review code
b. review code format

I am done with this review.

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-20 23:20:04
Message-ID: 4A64FBA4.4050802@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 7/16/09 1:55 PM, Andrew Dunstan wrote:
> Well, somebody had better suggest a syntax for it, preferably without
> adding yet another keyword.

Actually, all that needs to happen is for NULL AS to accept '""' as a
string. Right now that produces:

ERROR: CSV quote character must not appear in the NULL specification

What's the issue with that? I can see how NULL AS '"' would break
things, but if I wanted NULL AS '"Josh"' shouldn't I be able to have it?

--
Josh Berkus
PostgreSQL Experts Inc.
www.pgexperts.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE *
Date: 2009-07-20 23:42:23
Message-ID: 4A6500DF.9080602@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus wrote:
> On 7/16/09 1:55 PM, Andrew Dunstan wrote:
>> Well, somebody had better suggest a syntax for it, preferably without
>> adding yet another keyword.
>
> Actually, all that needs to happen is for NULL AS to accept '""' as a
> string. Right now that produces:
>
> ERROR: CSV quote character must not appear in the NULL specification
>
> What's the issue with that? I can see how NULL AS '"' would break
> things, but if I wanted NULL AS '"Josh"' shouldn't I be able to have it?
>

See previous thread on -patches/-hackers "allow CSV quote in NULL" in
July 2007.

Quite apart from any other objection, doing what you suggest will not be
column-by-column, like what I suggested. It's an all or nothing deal.

cheers

andrew


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-24 23:25:51
Message-ID: 4A6A42FF.1010501@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Josh Berkus wrote:
>
> Stuff someone else should do:
>
> a. review code
> b. review code format
>
> I am done with this review.

I have reviewed this and made a small tweak in the docco. I'm just about
ready to commit this, but I'm still slightly worried that passing NULL
to denote all columns in this piece of grammar:

| FORCE QUOTE '*'
{
$$ = makeDefElem("force_quote", NULL);
}

might be less than robust - it just feels slightly hacky, so I'd
appreciate others' thoughts. If nobody else is bothered I will commit
the patch.

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-24 23:31:13
Message-ID: 14965.1248478273@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I have reviewed this and made a small tweak in the docco. I'm just about
> ready to commit this, but I'm still slightly worried that passing NULL
> to denote all columns in this piece of grammar:

> | FORCE QUOTE '*'
> {
> $$ = makeDefElem("force_quote", NULL);
> }

> might be less than robust - it just feels slightly hacky, so I'd
> appreciate others' thoughts.

I agree, that's ugly. Why don't you use an A_Star node?

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY WITH CSV FORCE QUOTE * -- REVIEW
Date: 2009-07-25 00:08:13
Message-ID: 4A6A4CED.3010803@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I have reviewed this and made a small tweak in the docco. I'm just about
>> ready to commit this, but I'm still slightly worried that passing NULL
>> to denote all columns in this piece of grammar:
>>
>
>
>> | FORCE QUOTE '*'
>> {
>> $$ = makeDefElem("force_quote", NULL);
>> }
>>
>
>
>> might be less than robust - it just feels slightly hacky, so I'd
>> appreciate others' thoughts.
>>
>
> I agree, that's ugly. Why don't you use an A_Star node?
>
>
>

OK, Done and committed. Nice little addition.

cheers

andrew