Skip to content

Kernel API /api/query/sql support UNION statement #8226

@frostime

Description

@frostime

[v2.8.7] 思源更新后,SQL API 进行查询出现了问题

Describe the problem

我常用模板加 Query 来查询每天在日记里面记录的东西,但是在更新了思源到 2.8.7 版本后,突然无法查询了。

使用的语句如下:

select * from blocks where `subtype` = 'h2' and `hpath` like '%daily note/%/2023-05-10'
UNION
select * from blocks where `type` = 'd' and `hpath` like '%daily note/%/2023-05-10/%'

我特地下载了 2.8.6 版本作为对比,确认是 SQL API 接口的问题:

2.8.6 版本的表现

image

image

2.8.7 版本的表现

image

image

可以看到 data 为 None

附注

比较奇怪的是:其他的 sql 语句都没有问题,就是这一句出问题了。

而且我把这个出问题的 SQL 语句放在嵌入块里执行,反而又没什么问题。

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.8.7
- Operating System: win10
- Browser (if used): No

Log file

日志文件里没有看到相关的记录

image

More information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions