On Wed,  7 May 2008 03:16:19 -0000, "Greg Sabino Mullane"
<[EMAIL PROTECTED]> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> 
> 
> I've been wondering how best to solve the standard_conforming_strings
> (SCS) problem. Here's some quick background:

How about just doing what is asked for? 

> 
> In version of 8.2 of Postgres, this concept was introduced. As the
> docs say:
> 
>   "This controls whether ordinary string literals ('...') treat
>    backslashes literally, as specified in the SQL standard. ...
>    The default will change to on in a future release to improve
>    compatibility with the standard."
> 
> 
> In other words, 'foo\\bar' in 8.2 with SCS off is foo\x08ar,
> while 'foo\\bar' with SCS on is two backslashes, then the letter
> b.
> 

When SCS is on, 'foo\\bar' is the the correct interpretation.

> Basically, DBD::PG wll be simply using the E'' format to keep the
> actual things inside the single quotes the way they are now. I think
> trying to fully support the standard by allowing things like 'foo\\bar'
> to differ depending on context would cause too much confusion. Knowing
> when to switch from one form to another ('' to E'') will be very
> tricky, however.

How about making it optional? If people want the old escaping behavior when
SCS
is enabled, then give it to them with an attribute like
'pg_legacy_quoting_misfeature_support => 1'
otherwise respect the SCM setting. Once the user tells you that legacy
quoting style 
is desired then you can use E'' for all strings.

Since SCS is not the default, there is probably a good reason why user 
of the driver or the DBA turned SCS on.

-r



Reply via email to