Re: Back Slash \ issue

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Back Slash \ issue
Дата
Msg-id 20190503141001.pow4wl46qaapba6h@momjian.us
обсуждение исходный текст
Ответ на Re: Back Slash \ issue  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-general
On Fri, May  3, 2019 at 10:04:44AM -0400, Bruce Momjian wrote:
> On thing the original poster might be missing is that the copy DELIMITER
> is used between fields, while backslash is used as an escape before a
> single character.  While it might be tempting to try to redefine the
> escape character with the copy ESCAPE keyword, that keyword only works
> in CSV mode.
> 
> The Postgres COPY format is very reliable and able to dump/reload _any_
> data sequence.  Many commercial data dump implementations are simpler
> but are not able to be as reliable.

For example, if you are using | as a delimiter, how do you represent a
literal | in the data?  You have to use an escape character before it,
and that is what backslash does, and if you have a backslash in your
data, you have to use a backslash before it too.  CSV has a similar
problem with double-quotes in double-quoted strings, and this is handled
by default by using two double-quotes.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Back Slash \ issue
Следующее
От: Ravi Krishna
Дата:
Сообщение: Re: Back Slash \ issue