On Tue, Jan 24, 2017 at 11:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
vojta.rylko@gmail.com writes: > 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
I see no bug here. The pattern is wrong, but it happens not to notice in the first case because it never reaches the buggy part of the pattern.
Then consider a feature request that a malformed pattern be detected and fail independent of the data being checked. Such non-deterministic failure is at least a POLA violation and makes what should be a basically compile-time error into a run-time one.
I will agree that It is not a back-patchable bug (unless we decide to never fail and instead have a malformed pattern always return false - we'd at least be consistent - though probably not in a desirable way) but would say it is a defect that should be addressed in v10.