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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pgsql: Add regression tests for CSV and \., and add
Дата
Msg-id 200512281536.jBSFaK710720@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Add regression tests for CSV and \., and add  ("Andrew Dunstan" <andrew@dunslane.net>)
Список pgsql-committers
Andrew Dunstan wrote:
> Bruce Momjian said:
> >> 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.
> >
> > Have you looked at the regression tests I added?  \.x will no longer be
> > interpreted as an end-of-data marker:
> >
>
> Oh. I didn't realise that part of the behaviour had changed. Does that alter
> our robustness?

It improves our robustness, for sure.

> I still think it seems odd to quote the field depending on it being the only
> field. That feels more inconsistent than quoting it whenever it is \.
>
> But I guess it's a corner case that is hardly likely to happen in real life.

That is why I did it only for the single-column case, so the quoting
would happen only when required, and it would limit confusion.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

Предыдущее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: pgsql: Add regression tests for CSV and \., and add
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Remove silly use of DLLIMPORT.