Skip to content

PostgreSQL Lexer Fails to Parse Backslash ('\') #36416

@jiangtao69039

Description

@jiangtao69039

Description:
When using the REPLACE function in PostgreSQL with a backslash ('\') as the search string, the SQL parser fails to correctly identify the backslash as a valid token. Instead, it treats the backslash and subsequent characters as part of the same token. This issue arises due to the STRING_ matching rules in the Lexer, which are unable to handle the backslash properly.

Steps to Reproduce:
Run the following SQL query in PostgreSQL:

SELECT id, REPLACE(content, '\', 'a') AS replaced_content FROM test_table WHERE content = 'Y';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions