我有一个PostgreSQL 8.4数据库正在由我的控制之外的应用程序查询。查询如下面扔警告,但正在努力...PostgreSQL:非标准使用转义字符串
SELECT "tagname","tagindex","tagtype","tagdatatype" FROM "tagtable" WHERE "tagname" = 'Lift_Stations\07\ETMs\Generator_ETM'
然而,对于站08和09相同的查询是失败...
SELECT "tagname","tagindex","tagtype","tagdatatype" FROM "tagtable" WHERE "tagname" = 'Lift_Stations\08\ETMs\Generator_ETM'
WARNING: nonstandard use of escape in a string literal LINE 2: ...,"tagdatatype" FROM "tagtable" WHERE "tagname" = 'Lift_Stat... ^HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
ERROR: invalid byte sequence for encoding "UTF8": 0x00 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
*** Error ***
ERROR: invalid byte sequence for encoding "UTF8": 0x00 SQL state: 22021 Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
我知道问题是不正确的转义,但鉴于08和09是唯一没有工作的事实,我希望有人可以有一个明智的想法,如何解决这个问题。
谢谢!
'WHERE“tagname”= E'Lift_Stations \ 08 \ ETMs \ Generator_ETM''可以提供帮助。 – wildplasser
如果不工作wildplasser的解决方案,请尝试添加另一个反斜杠,更多信息请阅读[此链接](http://stackoverflow.com/a/943/1563878)。 –
@wildplasser我认为这是一条路径,他们不希望它被解释为转义序列。 –