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

Bug: SQLite 使用 $regex 时报错 #894

Closed
Tracked by #892
ifrvn opened this issue Dec 30, 2022 · 8 comments
Closed
Tracked by #892

Bug: SQLite 使用 $regex 时报错 #894

ifrvn opened this issue Dec 30, 2022 · 8 comments
Labels
bug BUG

Comments

@ifrvn
Copy link

ifrvn commented Dec 30, 2022

Describe the bug

使用 SQLite 时在 Query 中使用 $regex 会报 Error: no such function: regexp

Steps to reproduce

ctx.database.select('table_name', {
   userId: { $regex: /123/ }
})

Expected behavior

正确执行查询

Screenshots

image

Versions

  • @minatojs/driver-sqlite: ^3.1.0
  • koishi: ^4.10.10

Additional context

生成的SQL语句是对的

SELECT * FROM `table_name` fyrfpnfh WHERE `userId` regexp '123'
@ifrvn ifrvn added the bug BUG label Dec 30, 2022
@shigma
Copy link
Member

shigma commented Dec 31, 2022

image

有点奇怪,单测里明明可以用 regexp。不过 cordiverse/minato#12 也确实出现了类似的情况。我再看看。

@ifrvn
Copy link
Author

ifrvn commented Jan 2, 2023

定位到出问题的地方了,但是不太明白是为什么...Orz

ctx.database = database

image

@shigma
Copy link
Member

shigma commented Jan 2, 2023

玄学起来了!

cc @Anillc

@Anillc
Copy link
Member

Anillc commented Jan 3, 2023

我这边还是无法复现

image

@ifrvn
Copy link
Author

ifrvn commented Jan 3, 2023

image
image
看样子是internal/service的某个hook导致的,我再排查下是哪个插件。

@ifrvn
Copy link
Author

ifrvn commented Jan 3, 2023

禁用 @koishijs/plugin-dataview 就好了

@ifrvn
Copy link
Author

ifrvn commented Jan 3, 2023

@shigma
Copy link
Member

shigma commented Jan 3, 2023

好,看起来是我的锅了。感谢你提供详尽的信息。

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

No branches or pull requests

3 participants