Re: Unworkable column delimiter characters for COPY

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unworkable column delimiter characters for COPY
Date: 2007-12-27 19:23:12
Message-ID: 4773FBA0.5000509@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> Tom Lane wrote:
>>
>>> I think at minimum we need to forbid b, f, n, r, t, v, which are the
>>> control character representations currently recognized by COPY.
>>> But I'm tempted to make it reject all 26 lower-case ASCII letters,
>>> as a form of future-proofing. Thoughts?
>>>
>
>
>> Assuming this is only for non-CSV mode, it seems OK.
>>
>
> On looking closer, 'x', octal digits, and '.' would also be trouble.
> So I made it reject a-z, 0-9, and dot.
>

I take it upper case A-F are safe, even though they are hex digits,
because they wouldn't immediately follow the backslash?

> It appears that the CSV mode is a few bricks shy of a load here as
> well: it will let you do CSV DELIMITER '"' resulting in entirely
> broken output. It seems we ought to forbid delimiter from matching CSV
> quote or escape characters. I'll let you clean up that case though...
>
>
>

Lucky me. Ok, I'll look at it. Should be simple enough.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-12-27 19:37:18 Re: Spoofing as the postmaster
Previous Message Tom Lane 2007-12-27 18:32:01 Re: Unworkable column delimiter characters for COPY

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-12-27 20:29:30 Archiver behavior at shutdown
Previous Message Tom Lane 2007-12-27 18:32:01 Re: Unworkable column delimiter characters for COPY