BUG #18765: Inconsistent behaviour and errors with LIKE - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18765: Inconsistent behaviour and errors with LIKE
Date
Msg-id 18765-6c26d2047e6f5143@postgresql.org
Whole thread Raw
Responses Re: BUG #18765: Inconsistent behaviour and errors with LIKE
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18764: server closed the connection unexpectedly
Next
From: Tom Lane
Date:
Subject: Re: BUG #18764: server closed the connection unexpectedly