Re: PostgreSQL Developer Best Practices

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: PostgreSQL Developer Best Practices
Дата
Msg-id CAKFQuwYAphnk_=D4Ymgp+tvYa1jg04qXUt7miJUWhCfxLuvMRA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL Developer Best Practices  (Melvin Davidson <melvin6925@gmail.com>)
Список pgsql-general
On Saturday, August 22, 2015, Melvin Davidson <melvin6925@gmail.com> wrote:
>The correct way to escape a quote is to double quote it:  'Mr. M''vey'

That is a matter of opinion. However, the real problem is the enclosed backslashes, which is
beyond our control at this point. Therefore, the best solution is to use ESCAPE E.


Why is this a best practice and not just "how things work"?  If you want to use backlash escapes you use E''.  If you don't use a backslash escape it doesn't matter - except if you are writing a backslash and don't want to have to escape it.

Beyond that turn your idea of best practice into a requirement and enable standard-conforming-strings.

Always using E'' is pragmatic advice but hardly worthy of being considered best practice.  The best practice is to write code in such a way that you can leave standard conforming strings off AND not generate any warnings.

David J.


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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: PostgreSQL Developer Best Practices
Следующее
От: John R Pierce
Дата:
Сообщение: Re: PostgreSQL Developer Best Practices