Postgrest 查询 Select * from table when id = id or (user id = id and boolean = true)

问题描述

我正在尝试在 postgrest 上的 postgres 中做一个简单的查询

基本上这是我试图重新创建的查询 (ID、Other_id和boolean都是表中的列)

SELECT * 
FROM TABLE 
WHERE ID = 'ID' 
   OR (OTHER_ID = 'OTHER_ID' AND BOOLEAN = true);

我已经尝试了下面的 postgrest 网址(按照文档)

https://table?and=(id.eq.id,or(boolean.is.true,other_id.eq.other_id)) 但它不起作用。

感谢任何帮助。

解决方法

似乎您需要像这样传递它:

https://table?or=(id.eq.id,and=(boolean.is.true,other_id.eq.other_id))

基于文档,语法类似于 opertaor=(operand1,operand2) ,所以基本上你正在做或首先因为这就是你正在做的

OR=(x,Y) 但是 Y 是一个混合条件,所以 OR=(x,AND=(a,b))

希望一切都好起来。