Re: PostgreSQL Developer Best Practices

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Andy Colson <andy(at)squeakycode(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL Developer Best Practices
Date: 2015-08-22 20:25:44
Message-ID: CAKFQuwYAphnk_=D4Ymgp+tvYa1jg04qXUt7miJUWhCfxLuvMRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday, August 22, 2015, Melvin Davidson <melvin6925(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2015-08-22 20:37:47 Re: PostgreSQL Developer Best Practices
Previous Message Melvin Davidson 2015-08-22 19:57:22 Re: PostgreSQL Developer Best Practices