Bug #3645
String literal escape database warning in postgresql
Status: | Resolved | Start date: | 04/22/2013 | |
---|---|---|---|---|
Priority: | Medium | Due date: | ||
Assignee: | Sofia Papagiannaki | % Done: | 0% |
|
Category: | Pithos | Spent time: | - | |
Target version: | - |
Description
Pithos requires to escape SQL wildcards in order to permit such characters in object paths.
Therefore, uses backslashes to escape like patterns
Issue #1768
However, Postgresql 8.4, contrary to the SQL standard, treats dy default baskslashes as escape characters
(this has been changed since postgresql 9.1 - standard_conforming_strings has become on dy default)
http://stackoverflow.com/questions/2106207/escape-sql-like-value-for-postgres-with-psycopg2#answer-2106443
As a result, it produces the following output:
WARNING: nonstandard use of \\ in a string literal at character 101
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
for SQL statements (constructed by sqlalchemy) such as:
SELECT nodes.node FROM nodes WHERE nodes.path LIKE E'c18088be-16b1-4263-8180-043c54e22903' ESCAPE '\\'The proposed solutions are:
- pithos to use an escape character other than the backslash
(that has a different behavior among the different databases)
as proposed also here:
http://www.postgresql.org/docs/8.4/static/sql-syntax-lexical.html#AEN1313
or
- to turn off postgresql escape_string_warning:
http://www.postgresql.org/docs/8.4/static/runtime-config-compatible.html#GUC-ESCAPE-STRING-WARNING
Associated revisions
pithos: use other db escape string literal character
Refs: #3645
History
#1 Updated by Sofia Papagiannaki about 10 years ago
- Status changed from Assigned to Resolved