Skip site navigation (1) Skip section navigation (2)

Re: pgsql: Add regression tests for CSV and \., and add automatic quoting of

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <momjian(at)postgresql(dot)org>
Cc: <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add regression tests for CSV and \., and add automatic quoting of
Date: 2005-12-28 13:39:17
Message-ID: 3900.24.211.165.134.1135777157.squirrel@www.dunslane.net (view raw or flat)
Thread:
Lists: pgsql-committers
Andrew Dunstan said:
> Bruce Momjian said:
>> Log Message:
>> -----------
>> Add regression tests for CSV and \., and add automatic quoting of a
single column dump that has a \. value, so the load works properly.  I also
added documentation describing this issue.
>>
>
> This seems unnecessarily elaborate, in code that is already byzantine. I
think we can safely quote *any* field that has \. regardless of whether or
not it is a singleton. There's no need to make a single column a special
case - if it's valid for a singleton it's valid for any, and vice versa.
>


Now that I've woken up properly I realise that it's also just wrong - it
will miss the case we need to catch of the first column of a multi-column
line beginning with \. - just treat them all the same and all will be well.

Also, this test is suspicious:

    strcmp(string, "\\.") == 0

Don't we also want to quote it if the field reads \.x ?
    strncmp(string, "\\.",2) == 0
seems like it would be a better test.


cheers

andrew




Responses

pgsql-committers by date

Next:From: Bruce MomjianDate: 2005-12-28 14:38:32
Subject: pgsql: Update COPY CSV \.
Previous:From: Andrew DunstanDate: 2005-12-28 12:35:59
Subject: Re: pgsql: Add regression tests for CSV and \., and add automatic quoting of

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group