Skip to content

sql: Implement "ESCAPE" #23538

@thibaultmeyer

Description

@thibaultmeyer

FEATURE REQUEST

Please, implement the keyword ESCAPE, it is used by ORM (like ebean or hibernate) when a LIKE predicate is present.

Official PostgreSQL says:

string LIKE pattern [ESCAPE escape-character]
string NOT LIKE pattern [ESCAPE escape-character]
string SIMILAR TO pattern [ESCAPE escape-character]
string NOT SIMILAR TO pattern [ESCAPE escape-character]

The default escape character is the backslash but a different one can be selected by using the ESCAPE clause. To match the escape character itself, write two escape characters.

Query sample:

SELECT * FROM account WHERE first_name LIKE 'bob' ESCAPE '';  -- ORM generated query
SELECT 'A' LIKE '\A' ESCAPE '\';  -- return true

Metadata

Metadata

Assignees

Labels

A-sql-pgcompatSemantic compatibility with PostgreSQLC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)good first issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions