| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | anmol(dot)mohanty(at)salesforce(dot)com | 
| Subject: | BUG #18765: Inconsistent behaviour and errors with LIKE | 
| Date: | 2025-01-03 16:47:05 | 
| Message-ID: | 18765-6c26d2047e6f5143@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      18765
Logged by:          Anmol Mohanty
Email address:      anmol(dot)mohanty(at)salesforce(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-01-03 16:56:57 | Re: BUG #18764: server closed the connection unexpectedly | 
| Previous Message | PG Bug reporting form | 2025-01-03 07:36:29 | BUG #18764: server closed the connection unexpectedly |