PostgreSQL will not always detect an invalid LIKE pattern (one that ends with a backslash).
Example:
tudor=# select 'foo' like 'foo\'; ?column? ---------- f (1 row)
tudor=# select 'foobar' like 'foo\'; ERROR: LIKE pattern must not end with escape character
This probably happens because the pattern is only parsed lazily (as needed); if PostgreSQL detects that a match is impossible, it doesn't even look at the rest of the pattern.
Still, it would be nice for error reporting to be consistent.
Last March (Bug# 14512) Tom Lane thought a performant solution was possible though it was never committed.