Hi everyone, I'm having trouble with backslash escapes in PostgreSQL 8.3 and SQLObject.
I currently have a Resource class that looks like: class Resource(SQLObject): resource = UnicodeCol(unique=True) @classmethod def autocomplete(cls, input): """ Controller for the autocomplete widget. """ return cls.select(cls.q.resource.startswith(input)) If I call Resource.autocomplete('blah'), the following statement is generated: SELECT collateral.id, collateral.resource, collateral.description, collateral.icon FROM collateral WHERE ((collateral.resource) LIKE ('blah%')) That works great, but if I call it with r'\', like so, I get an error from postgres: 2008-06-09 11:43:21 BST WARNING: nonstandard use of \\ in a string literal at character 135 2008-06-09 11:43:21 BST HINT: Use the escape string syntax for backslashes, e.g., E'\\'. 2008-06-09 11:43:21 BST LOG: statement: SELECT collateral.id, collateral.resource, collateral.description, collateral.icon FROM collateral WHERE ((collateral.resource) LIKE ('\\%')) and no records are returned, despite there being records in the table starting with '\'. Currently I'm working around this by duplicating the backslash in python, which generates the same error from postgres but actually returns records beginning with a single backslash. It looks like postgres has a special E'' syntax for escaping which I don't entirely understand, but would it make sense for SQLObject to be using that in the future? Thanks, Nick ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss