http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5299
Summary: BayesStore/PgSQL: nonstandard use of \\ in a string
literal warning
Product: Spamassassin
Version: 3.1.7
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P3
Component: Libraries
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
When using PostgreSQL (8.2.1) as Bayes back-end
the following warning is issued:
$ sa-learn --ham 0.msg
WARNING: nonstandard use of \\ in a string literal
LINE 1: select put_tokens(1, '{"\\\\000\\\\172\\\\121\\\\370\\\\065"...
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
Translation: an escaped string should use extended-standard syntax E'...'
instead of a non-standard regular '...' (which is not supposed to
use \escapes ).
The attached patch fixes the problem (and for good measure
also streamlines sub _quote_bytea).
Here is a reference to PostgreSQL documentation:
http://www.postgresql.org/docs/8.2/interactive/sql-syntax-lexical.html
and a relevant quotatation:
PostgreSQL also accepts "escape" string constants, which are an extension
to the SQL standard. An escape string constant is specified by writing
the letter E (upper or lower case) just before the opening single quote,
e.g. E'foo'. [...]
Caution
If the configuration parameter standard_conforming_strings is off, then
PostgreSQL recognizes backslash escapes in both regular and escape
string constants. This is for backward compatibility with the historical
behavior, in which backslash escapes were always recognized. Although
standard_conforming_strings currently defaults to off, the default
will change to on in a future release for improved standards compliance.
Applications are therefore encouraged to migrate away from using backslash
escapes. If you need to use a backslash escape to represent a special
character, write the constant with an E to be sure it will be handled
the same way in future releases.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.