Re: BUG #18765: Inconsistent behaviour and errors with LIKE
От | David G. Johnston |
---|---|
Тема | Re: BUG #18765: Inconsistent behaviour and errors with LIKE |
Дата | |
Msg-id | CAKFQuwaoWrRuM544zDqnTg2wnB8fkQgOe0qAHrvHmDQgAyLGcw@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #18765: Inconsistent behaviour and errors with LIKE (PG Bug reporting form <noreply@postgresql.org>) |
Список | pgsql-bugs |
On Fri, Jan 3, 2025 at 10:04 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 18765
Logged by: Anmol Mohanty
Email address: anmol.mohanty@salesforce.com
PostgreSQL version: 17.0
Operating system: NA(used fiddle tool at sqlfiddle.com)
Description:
select 'a\' like 'a\'; -- error - LIKE pattern must not end with escape
character
select 'a' like 'a\'; -- f - query runs
This doesn't make sense. The LIKE pattern is incorrect in both.
I've also checked around constant folding and runtime non-literal values by
inserting into cte's and temp tables. Same outcome.
```
WITH a AS (SELECT 'xyz' AS value)
SELECT value LIKE 'xyz\' AS result
FROM a;
```
f
Working as designed.
Execution optimization combined with non-compilation.
You may not get a failure if the condition is proven to evaluate to false before encountering the malformed part of the expression. There is no compilation step that evaluates the supplied text for correctness independent of its usage. The input string running out of characters while the test string still has some is known to result in a false outcome.
David J.
В списке pgsql-bugs по дате отправления: