Hi list,
I have recently noticed the following warning in various places in regards to Rails and YAML serialized data:
WARNING: nonstandard use of \\ in a string literal
LINE 1: ...ed_at" = '2007-09-11 14:51:31', "serialized_replies" = '---
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
It doesn't seem to yield any problems. Is this a bug or a bad configuration on my part or something else?
Historically PostgreSQL has allowed c-style escapes (such as \n) in strings. As this does not comply with the SQL standard, the option to use treat \ as just any other character was introduced (in 8.1 IIRC, see standard_conforming_strings). As well, a new E-string syntax was added which allows you to use \ as an escape character.
You can set standard_conforming_strings in postgresql.conf or at the session level using SET. This should get rid of the warning. I'm not sure how the new version of the PostgreSQL adapter (in Edge) behaves, but you might want to look into that as well if you're interested.
Michael Glaesemann
grzm seespotcode net
Michael Glaesemann wrote:
WARNING: nonstandard use of \\ in a string literal
LINE 1: ...ed_at" = '2007-09-11 14:51:31', "serialized_replies" = '---
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
It doesn't seem to yield any problems. Is this a bug or a bad
configuration on my part or something else?
Historically PostgreSQL has allowed c-style escapes (such as \n) in strings. As this does not comply with the SQL standard, the option to use treat \ as just any other character was introduced (in 8.1 IIRC, see standard_conforming_strings). As well, a new E-string syntax was added which allows you to use \ as an escape character.
You can set standard_conforming_strings in postgresql.conf or at the session level using SET. This should get rid of the warning. I'm not sure how the new version of the PostgreSQL adapter (in Edge) behaves, but you might want to look into that as well if you're interested.
Thanks for the information. I'll check out edge to see if it's fixed there.