Re: BUG #7709: psql \copy csv terminates with \. in quoted region

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7709: psql \copy csv terminates with \. in quoted region
Дата
Msg-id 24679.1354037624@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7709: psql \copy csv terminates with \. in quoted region  (tgarnett@panjiva.com)
Ответы Re: BUG #7709: psql \copy csv terminates with \. in quoted region  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-bugs
tgarnett@panjiva.com writes:
> psql \copy terminates at \. by itself in a line even if the format is csv
> and the \. is inside a quoted region.  This means that some values can't be
> round-tripped by psql \copy. Tested and the native postgresql COPY handles
> this case correctly.

Ugh.  This seems like a rather fundamental oversight in the CSV feature.
The problem is that psql has no idea whether the copy is being done in
CSV mode or not --- and even if it did, it doesn't parse the data fully
enough to realize whether a \. line is inside quotes or not.

In the case of out-of-line data files, it might be reasonable to just
dispense with the check for \. altogether and always ship the whole file
to the backend; I think there's a \. check on the backend side.  (Not
sure this is safe in V2 protocol, but I doubt anyone cares anymore
about that.)

In the case of in-line data in a script file, CSV mode seems a bit
broken in any case; there's no concept of a terminator in CSV, AFAIK.
So maybe we don't have to worry about that.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: tgarnett@panjiva.com
Дата:
Сообщение: BUG #7709: psql \copy csv terminates with \. in quoted region
Следующее
От: Jeff Janes
Дата:
Сообщение: PITR potentially broken in 9.2