Re: BUG #15421: Error: LIKE pattern must not end with escape character
От | Tom Lane |
---|---|
Тема | Re: BUG #15421: Error: LIKE pattern must not end with escape character |
Дата | |
Msg-id | 4710.1538748537@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #15421: Error: LIKE pattern must not end with escape character (PG Bug reporting form <noreply@postgresql.org>) |
Список | pgsql-bugs |
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes: > If I try to query the table with LIKE statement: > SELECT COUNT(id) AS "records_found" FROM "tmp" WHERE lower("tmp"."name") > LIKE 't\' I get the error "Error: LIKE pattern must not end with escape > character". > If I try to query the statement SELECT COUNT(id) AS "records_found" FROM > "tmp" WHERE lower("tmp"."name") LIKE 'rs\' and others that do not match any > records, there are no errors at all. Yeah, the pattern is wrong, but the error is only detected if scanning of the pattern reaches the end, which it won't if the match always fails before that. This has been complained of several times before, but it's something that doesn't seem worth taking any performance hit for. It's possible that something along the lines of what I sketched in https://www.postgresql.org/message-id/28169.1489781085@sss.pgh.pa.us would be close enough to zero net cost to be OK. Nobody's pursued it though. regards, tom lane
В списке pgsql-bugs по дате отправления: