Jack Orenstein wrote:
In this code, The string passed to JDBC is %\% (percent, one
backslash, percent), and no rows are returned.
It appears as if the one backslash is being treated as an
escape for the %.
That's right. So \% as a pattern matches a percent, and \\ as a pattern
matche
Tom Lane wrote:
My Java is pretty weak, but doesn't it think that backslash is special
in string literals? If I assume that each pair of \'s in your examples
went to the database as one \, then the results are what I'd expect.
regards, tom lane
Daniel Verite wrote:
>
Jack Orenstein wrote:
Can someone help in my understanding of what is correct
behavior (in the literal and bound variable cases)?
Is there a bug in the driver? in postgres? in the
docs? Or in my understanding?
LIKE E'%\\%' will match a string that ends with a percent sign, not a
stri
Jack Orenstein writes:
> I wrote a JDBC test program, with two variants.
My Java is pretty weak, but doesn't it think that backslash is special
in string literals? If I assume that each pair of \'s in your examples
went to the database as one \, then the results are what I'd expect.
Suppose I have this table:
create table test(id int, x varchar)
And I want to find rows whose x contains at least one backslash. The backslash
has to be escaped according to section 9.7.1 of the postgres docs.
select *
from test
where x like E'%\\%'
I'll skip the results of m