Hi, LIKE behaves differently depending on left side.
???
> select 1 where '\' like '\\\'; -- one and three backslashes ?column? ---------- (0 rows)
> select 1 where '\\' like '\\\'; -- two and three backslashes ERROR: LIKE pattern must not end with escape character
The right-hand side is the "pattern" - i.e., <\\\> - which ends with the escape...
Never mind - I was multi-tasking and mis-read what you wrote...
I'll give it more attention when I have a moment if no one else chimes in first.
Not a hacker but I'd say that the '\' LIKE '\\\' expression is encountering an invalid optimization that determines that the LIKE cannot succeed (due to string length differences, probably) - it too should fail like the other '\\' LIKE '\\\' example.
So, it is a "failure to fail" type of bug. Confirmed using a 9.3.12 instance.