Skip to content

MySQL's REGEXP binary operator is not supported #107

Closed

Description

@accforgithubtest

I have gotten sqlpage to work with mysql, and able to see the data on UI for a bunch of queries.

However, any query with a REGEXP in it seems to cause the error -

Backtrace
sql parser error: Expected an SQL statement, found: REGEXP at Line: 26, Column 15
SQLPage could not parse and prepare this SQL statement

Is REGEXP somehow not supported in sqlpage ?
[I have confirmed the exact same query to be working outside sqlpage.]

Activity

  1. lovasoa commented on Oct 20, 2023

    @lovasoa
    Collaborator

    SQLPage needs to parse your queries in order to know which parameters to extract from the user's request to pass to the database, and to implement SQLPage functions.

    To do that, it uses a very powerful and versatile SQL parser: sqlparser-rs. It's the same parser that is used in InfluxDB and Apache DataFusion, among others.

    However, it may happen that some syntax that is valid in one database is not supported by the parser. When this happens, you can open an issue here with an example failing query, and we will implement it upstream in sqlparser. In this case, I opened this issue.

    In the meantime, you can use the traditional function syntax for matching regular expressions:

    select regexp_like('hello', '^hell');

    instead of

    select 'hello' REGEXP '^hell';
  2. self-assigned this
    on Oct 20, 2023
  3. changed the title [-]MySQL + REGEXP supported ?[/-] [+]MySQL's `REGEXP` binary operator is not supported[/+] on Oct 20, 2023
  4. accforgithubtest commented on Oct 21, 2023

    @accforgithubtest
    Author

    Thanks for the suggestions and also raising the issue, will give this a spin ! Thank you.

  5. lovasoa commented on Oct 21, 2023

    @lovasoa
    Collaborator

    My patch to sqlparser-rs was merged, we'll soon have support for the REGEXP operator in sqlpage 🎊

  6. added a commit that references this issue on Oct 29, 2023
  7. lovasoa commented on Nov 1, 2023

    @lovasoa
    Collaborator

    fix released in v0.15

  8. accforgithubtest commented on Nov 1, 2023

    @accforgithubtest
    Author

    thanks @lovasoa ! Just tried this with latest version and it works !

  9. added a commit that references this issue on Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions