Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIKE ... ESCAPE <escape_char> should accept an empty string #1198

Open
TennyZhuang opened this issue Mar 29, 2024 · 4 comments
Open

LIKE ... ESCAPE <escape_char> should accept an empty string #1198

TennyZhuang opened this issue Mar 29, 2024 · 4 comments

Comments

@TennyZhuang
Copy link

TennyZhuang commented Mar 29, 2024

Currently, we use Option<char> to represent escape_char, which cannot represent three case. We should introduce a new enum to represent that.

enum EscapeChar {
    NotSpecified,
    Empty,
    Escape(char),
}

to pass the case:

https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-LIKE:~:text=it's%20also%20possible%20to%20select%20no%20escape%20character%20by%20writing%20escape%20''

@TennyZhuang TennyZhuang changed the title LIKE ... ESCAPE <escape_char> can be an empty character LIKE ... ESCAPE <escape_char> should accept an empty character Mar 29, 2024
@TennyZhuang
Copy link
Author

I can help to implement that.

@TennyZhuang TennyZhuang changed the title LIKE ... ESCAPE <escape_char> should accept an empty character LIKE ... ESCAPE <escape_char> should accept an empty string Mar 29, 2024
@TennyZhuang
Copy link
Author

Another option is create a newtype EscapeChar to represent '' or a single character, and store an Option<EscapeChar> in the AST.

@TennyZhuang
Copy link
Author

I'd like to port risingwavelabs/risingwave@b05cb06 back to the repo, if the fix is reasonable.

@alamb
Copy link
Collaborator

alamb commented Apr 10, 2024

Seems resonable to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants