[SQL] = or LIKE ?

2009-02-15 Thread Jesper Krogh
Hi. Can anyone explain me this behavior? testdb=# select E'\\' = E'\\'; ?column? -- t (1 row) testdb=# select E'\\' like E'\\'; ?column? -- f (1 row) Shouldnt the like operator do the same as the = if there occours no wildcards and stuff in the string? -- Jesper -- Sen

Re: [SQL] = or LIKE ?

2009-02-15 Thread Tom Lane
Jesper Krogh writes: > Shouldnt the like operator do the same as the = if there occours no > wildcards and stuff in the string? If there are also no escape characters, then yeah. FWIW, 8.4 will complain about this case: regression=# select E'\\' like E'\\'; ERROR: LIKE pattern must not end wi

Re: [SQL] = or LIKE ?

2009-02-15 Thread Jesper Krogh
Tom Lane wrote: Jesper Krogh writes: Shouldnt the like operator do the same as the = if there occours no wildcards and stuff in the string? If there are also no escape characters, then yeah. FWIW, 8.4 will complain about this case: regression=# select E'\\' like E'\\'; ERROR: LIKE pattern

Re: [SQL] = or LIKE ?

2009-02-15 Thread Jesper Krogh
Jesper Krogh wrote: Tom Lane wrote: Jesper Krogh writes: Shouldnt the like operator do the same as the = if there occours no wildcards and stuff in the string? If there are also no escape characters, then yeah. FWIW, 8.4 will complain about this case: regression=# select E'\\' like E'\\';

Re: [SQL] = or LIKE ?

2009-02-15 Thread Tom Lane
Jesper Krogh writes: > Ok. The pattern has to be "double escaped".. Or specify a different escape character. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sq

Re: [SQL] = or LIKE ?

2009-02-15 Thread Craig Ringer
Jesper Krogh wrote: So I cannot rely on the like operator to behave correct if I'd like to compare strings with backslashes (e.g. filepaths from MS Windows filesystems)? test=# SELECT E'\\' LIKE E'\\' ESCAPE ''; ?column? -- t (1 row) -- Craig Ringer -- Sent via pgsql-sql mailing l