Re: Fixing backslash dot for COPY FROM...CSV

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing backslash dot for COPY FROM...CSV
Date: 2024-04-07 04:07:13
Message-ID: 2726138.1712462833@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Sun, Apr 7, 2024 at 12:00:25AM +0200, Daniel Verite wrote:
>> Agreed we don't want to document that, but also why doesn't \. in the
>> contents represent just a dot (as opposed to being an error),
>> just like \a is a?

> I looked into this and started to realize that \. is the only copy
> backslash command where we define the behavior only alone at the
> beginning of a line, and not in other circumstances. The \a example
> above suggests \. should be period in all other cases, as suggested, but
> I don't know the ramifications if that.

Here's the problem: if some client-side code thinks it's okay to
quote "." as "\.", what is likely to happen when it's presented
a data value consisting only of "."? It could very easily fall
into the trap of producing an end-of-data marker.

If we get rid of the whole concept of end-of-data markers, then
it'd be totally reasonable to accept "\." as ".". But as long
as we still have end-of-data markers, I think it's unwise to allow
"\." to appear as anything but an end-of-data marker. It'd just
add camouflage to the booby trap.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-04-07 04:17:34 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Nathan Bossart 2024-04-07 04:05:31 Re: Popcount optimization using AVX512